Skip to content

Commit

Permalink
Stream output from launched command
Browse files Browse the repository at this point in the history
  • Loading branch information
afh committed Feb 17, 2024
1 parent e9993a1 commit 62b523a
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/bin/envio/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 } => {
Expand Down

0 comments on commit 62b523a

Please sign in to comment.