Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
vporton committed Jan 29, 2025
1 parent 04d29e4 commit f0e6617
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/dfx/src/config/cache.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::config::dfx_version;
use crate::lib::environment::Environment;
use crate::lib::error::DfxResult;
use crate::lib::progress_bar::ProgressBar;
use crate::util;
use dfx_core;
Expand Down Expand Up @@ -70,9 +71,19 @@ impl VersionCache {
&self,
env: &dyn Environment,
binary_name: &str,
) -> Result<std::process::Command, GetBinaryCommandPathError> {
) -> DfxResult<std::process::Command> {
Self::install(env, &self.version_str())?;
let path = binary_command_from_version(&self.version_str(), binary_name)?;
let mut path = binary_command_from_version(&self.version_str(), binary_name)?;

// We need to ensure that it works well with relative paths:
let config = env.get_config()?;
if let Some(config) = config {
let workspace_root = config.get_path().parent();
if let Some(workspace_root) = workspace_root {
path.current_dir(workspace_root);
}
}

Ok(path)
}
}
Expand Down

0 comments on commit f0e6617

Please sign in to comment.