Skip to content

Commit

Permalink
add anchor_mark
Browse files Browse the repository at this point in the history
  • Loading branch information
ityuany committed Jul 13, 2024
1 parent f56a870 commit 4e0d265
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions crates/snm_shim/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,23 @@ use snm_package_manager::snm_package_manager::SnmPackageManager;
use snm_utils::{exec::exec_cli, snm_error::SnmError};
use std::env::{self, current_dir};

fn anchor_mark() -> Result<(), SnmError> {
match env::var("SNM_ANCHOR") {
Ok(_) => return Err(SnmError::NotFoundValidVersion),
Err(_) => {
env::set_var("SNM_ANCHOR", "true");
}
}
Ok(())
}

pub async fn load_package_manage_shim(prefix: &str, bin_name: &str) -> Result<(), SnmError> {
env_logger::init();

let args_all: Vec<String> = env::args().collect();

anchor_mark()?;

let command = &args_all[1];

let args: Vec<String> = std::env::args().skip(1).collect();
Expand Down Expand Up @@ -76,6 +88,8 @@ pub async fn load_package_manage_shim(prefix: &str, bin_name: &str) -> Result<()
pub async fn get_node_bin_dir() -> Result<String, SnmError> {
let dir = current_dir()?;

anchor_mark()?;

let snm_config = parse_snm_config(&dir)?;

let snm_node: &dyn AtomTrait = &SnmNode::new(snm_config.clone());
Expand Down

0 comments on commit 4e0d265

Please sign in to comment.