From 6bfff0060102936b03265430eb46cb43fed62736 Mon Sep 17 00:00:00 2001 From: ityuany <519495771@qq.com> Date: Mon, 29 Jul 2024 17:46:52 +0800 Subject: [PATCH] remove exec --- e2e/tests/snm_install_test.rs | 42 +---------------------------------- 1 file changed, 1 insertion(+), 41 deletions(-) diff --git a/e2e/tests/snm_install_test.rs b/e2e/tests/snm_install_test.rs index b4339e5f..e464fd4a 100644 --- a/e2e/tests/snm_install_test.rs +++ b/e2e/tests/snm_install_test.rs @@ -1,10 +1,4 @@ -use std::{ - env::current_dir, - error::Error, - fs, - path::PathBuf, - process::{Command, Output}, -}; +use std::{env::current_dir, error::Error, fs}; use e2e::exec_builder::ExecBuilder; use tempfile::tempdir; @@ -16,40 +10,6 @@ use tempfile::tempdir; const SNM_CMD: &str = "snm"; -fn exec( - shell: &str, - current: &PathBuf, - envs: &Vec<(&str, String)>, -) -> Result> { - let shell_vec = shell - .split(" ") - .map(|item| item.trim()) - .collect::>(); - - if let Some((bin_name, args)) = shell_vec.split_first() { - let output = Command::new(bin_name) - .envs(envs.clone()) - .args(args) - .current_dir(current) - .output()?; - - let stdout = String::from_utf8_lossy(&output.stdout).to_string(); - let stderr = String::from_utf8_lossy(&output.stderr).to_string(); - - println!( - r##" -Exec shell: {} -Stdout: {} -Stderr: {} - "##, - shell, stdout, stderr - ); - Ok(stdout) - } else { - Err("Invalid shell command".into()) - } -} - #[test] fn should_auto_install() -> Result<(), Box> { let node_version = "16.0.0";