From 61501b48f53c500077851b47061b16b6c7df3d3c Mon Sep 17 00:00:00 2001 From: ityuany <519495771@qq.com> Date: Mon, 22 Jul 2024 16:06:36 +0800 Subject: [PATCH] fix --- crates/snm_shim/src/ensure_binary_path.rs | 10 ++++++++-- crates/snm_shim/src/get_node_bin_dir.rs | 2 +- crates/snm_shim/src/lib.rs | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/crates/snm_shim/src/ensure_binary_path.rs b/crates/snm_shim/src/ensure_binary_path.rs index baafc2fa..c5086ac5 100644 --- a/crates/snm_shim/src/ensure_binary_path.rs +++ b/crates/snm_shim/src/ensure_binary_path.rs @@ -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(atom: &T, version: &String) -> Result +pub async fn ensure_binary_path( + atom: &T, + version: &String, + is_check: bool, +) -> Result where T: AtomTrait, { @@ -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)?; diff --git a/crates/snm_shim/src/get_node_bin_dir.rs b/crates/snm_shim/src/get_node_bin_dir.rs index 7ba63303..7e503e8f 100644 --- a/crates/snm_shim/src/get_node_bin_dir.rs +++ b/crates/snm_shim/src/get_node_bin_dir.rs @@ -24,7 +24,7 @@ pub async fn get_node_bin_dir() -> Result { 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) } diff --git a/crates/snm_shim/src/lib.rs b/crates/snm_shim/src/lib.rs index 2d2120b2..32819ab4 100644 --- a/crates/snm_shim/src/lib.rs +++ b/crates/snm_shim/src/lib.rs @@ -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 {