Skip to content

Commit

Permalink
remove exec
Browse files Browse the repository at this point in the history
  • Loading branch information
ityuany committed Jul 29, 2024
1 parent d3bfd55 commit 6bfff00
Showing 1 changed file with 1 addition and 41 deletions.
42 changes: 1 addition & 41 deletions e2e/tests/snm_install_test.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -16,40 +10,6 @@ use tempfile::tempdir;

const SNM_CMD: &str = "snm";

fn exec(
shell: &str,
current: &PathBuf,
envs: &Vec<(&str, String)>,
) -> Result<String, Box<dyn Error>> {
let shell_vec = shell
.split(" ")
.map(|item| item.trim())
.collect::<Vec<&str>>();

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<dyn Error>> {
let node_version = "16.0.0";
Expand Down

0 comments on commit 6bfff00

Please sign in to comment.