Skip to content

Commit

Permalink
fix: elixir installation failed
Browse files Browse the repository at this point in the history
  • Loading branch information
roele committed Jan 23, 2025
1 parent 5b2d795 commit 7b5b088
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/cli/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ impl Install {
pub fn run(self) -> Result<()> {
let config = Config::try_get()?;
match &self.tool {
Some(runtime) => self.install_runtimes(&config, runtime)?,
Some(runtime) => {
crate::env::TOOL_ARGS.write().unwrap().clone_from(&runtime);
self.install_runtimes(&config, runtime)?
}
None => self.install_missing_runtimes(&config)?,
};
Ok(())
Expand Down
4 changes: 4 additions & 0 deletions src/cli/use.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ impl Use {
if self.tool.is_empty() && self.remove.is_empty() {
self.tool = vec![self.tool_selector()?];
}
crate::env::TOOL_ARGS
.write()
.unwrap()
.clone_from(&self.tool);
let config = Config::try_get()?;
let mut ts = ToolsetBuilder::new()
.with_global_only(self.global)
Expand Down
3 changes: 2 additions & 1 deletion src/env.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::cli::args::{ENV_ARG, PROFILE_ARG};
use crate::cli::args::{ToolArg, ENV_ARG, PROFILE_ARG};
use crate::env_diff::{EnvDiff, EnvDiffOperation, EnvDiffPatches, EnvMap};
use crate::file::replace_path;
use crate::shell::ShellType;
Expand All @@ -14,6 +14,7 @@ use std::sync::RwLock;
use std::{path, process};

pub static ARGS: RwLock<Vec<String>> = RwLock::new(vec![]);
pub static TOOL_ARGS: RwLock<Vec<ToolArg>> = RwLock::new(vec![]);
#[cfg(unix)]
pub static SHELL: Lazy<String> = Lazy::new(|| var("SHELL").unwrap_or_else(|_| "sh".into()));
#[cfg(windows)]
Expand Down
10 changes: 10 additions & 0 deletions src/toolset/tool_request_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,16 @@ impl ToolRequestSetBuilder {
}
merge(trs, arg_ts);
}

let tool_args = env::TOOL_ARGS.read().unwrap();
let mut arg_trs = ToolRequestSet::new();
for arg in tool_args.iter() {
if let Some(tvr) = &arg.tvr {
arg_trs.add_version(tvr.clone(), &ToolSource::Argument);
}
}
merge(trs, arg_trs);

Ok(())
}
}
Expand Down

0 comments on commit 7b5b088

Please sign in to comment.