feat: with direct output

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
Kasper Juul Hermansen 2023-06-25 13:43:42 +02:00
parent dc0fa589a5
commit f8035357b7
Signed by: kjuulh
GPG Key ID: 57B6E1465221F912

View File

@ -29,10 +29,8 @@ impl ShellAction {
let current_dir = current_dir()?; let current_dir = current_dir()?;
log::trace!("current executable dir={}", current_dir.to_string_lossy()); log::trace!("current executable dir={}", current_dir.to_string_lossy());
let mut process = Command::new(path.clone()) let mut process = Command::new(&path)
.current_dir(current_dir) .current_dir(current_dir)
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.envs(variables.iter().map(|v| { .envs(variables.iter().map(|v| {
log::trace!("{:?}", v); log::trace!("{:?}", v);
@ -40,20 +38,6 @@ impl ShellAction {
})) }))
.spawn()?; .spawn()?;
if let Some(ref mut stdout) = process.stdout {
for line in BufReader::new(stdout).lines() {
let line = line.unwrap();
println!("[{}] {}", self.name, line);
}
}
if let Some(ref mut stderr) = process.stderr {
for line in BufReader::new(stderr).lines() {
let line = line.unwrap();
println!("[{}] {}", self.name, line);
}
}
let status = process.wait()?; let status = process.wait()?;
match status.code() { match status.code() {