From 62b523a9b1414218bc0c4f4e11b7d963b19d5f07 Mon Sep 17 00:00:00 2001 From: Alexis Hildebrandt Date: Sat, 17 Feb 2024 12:22:02 +0100 Subject: [PATCH] Stream output from launched command --- src/bin/envio/commands.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/bin/envio/commands.rs b/src/bin/envio/commands.rs index f00818a..d88387a 100755 --- a/src/bin/envio/commands.rs +++ b/src/bin/envio/commands.rs @@ -354,17 +354,15 @@ impl Command { return; }; - let output = std::process::Command::new(&program) + let mut cmd = std::process::Command::new(&program) .envs(profile.envs) .args(args) - .output() + .stdout(std::process::Stdio::inherit()) + .stderr(std::process::Stdio::inherit()) + .spawn() .expect("Failed to execute command"); - - if output.stderr.is_empty() { - println!("{}", String::from_utf8(output.stdout).unwrap()); - } else { - println!("{}", String::from_utf8(output.stderr).unwrap()); - } + let status = cmd.wait().unwrap(); + std::process::exit(status.code().unwrap()); } Command::Remove { profile_name, envs } => {