fix: use command's STDOUT

This commit is contained in:
iff 2023-07-31 00:27:36 +02:00
parent 1f15d92f72
commit 54b81e0e0f
2 changed files with 32 additions and 13 deletions

View file

@ -50,11 +50,15 @@ pub fn find_last_command(shell: &str) -> String {
}
pub fn command_output(shell: &str, command: &str) -> String {
println!("Running command: {}", command);
let output = std::process::Command::new(shell)
.arg("-c")
.arg(command)
.output()
.expect("failed to execute process");
.stderr(std::process::Stdio::piped())
.spawn()
.expect("failed to execute process")
.wait_with_output()
.expect("failed to wait on process");
String::from_utf8_lossy(&output.stderr)
.to_string()