Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ityuany committed Jul 22, 2024
1 parent babc6bd commit 61501b4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions crates/snm_shim/src/ensure_binary_path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ use snm_atom::atom::AtomTrait;
use snm_download_builder::{DownloadBuilder, WriteStrategy};
use snm_utils::snm_error::SnmError;

pub async fn ensure_binary_path<T>(atom: &T, version: &String) -> Result<String, SnmError>
pub async fn ensure_binary_path<T>(
atom: &T,
version: &String,
is_check: bool,
) -> Result<String, SnmError>
where
T: AtomTrait,
{
Expand All @@ -31,7 +35,9 @@ where

let runtime_dir_path_buf = atom.get_runtime_dir_path_buf(version)?;

check(version, atom).await?;
if is_check {
check(version, atom).await?;
}

atom.decompress_download_file(&downloaded_file_path_buf, &runtime_dir_path_buf)?;

Expand Down
2 changes: 1 addition & 1 deletion crates/snm_shim/src/get_node_bin_dir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub async fn get_node_bin_dir() -> Result<String, SnmError> {
version.ok_or(SnmError::NoDefaultNodeBinary)?
};

let binary_dir_string = ensure_binary_path(&snm_node, &version).await?;
let binary_dir_string = ensure_binary_path(&snm_node, &version, true).await?;

Ok(binary_dir_string)
}
2 changes: 1 addition & 1 deletion crates/snm_shim/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub async fn load_package_manage_shim(prefix: &str, bin_name: &str) -> Result<()
let version = package_manager.version;
vec![
node_dir.clone(),
ensure_binary_path(&snm_package_manage, &version).await?,
ensure_binary_path(&snm_package_manage, &version, false).await?,
]
} else if restricted_list.contains(&command.as_str()) {
return Err(SnmError::NotMatchPackageManagerError {
Expand Down

0 comments on commit 61501b4

Please sign in to comment.