Skip to content

Commit

Permalink
Add debug tracing for failed commands
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn3 committed Sep 7, 2023
1 parent d72f710 commit 6923b51
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion build_system/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,9 @@ pub(crate) fn try_hard_link(src: impl AsRef<Path>, dst: impl AsRef<Path>) {

#[track_caller]
pub(crate) fn spawn_and_wait(mut cmd: Command) {
if !cmd.spawn().unwrap().wait().unwrap().success() {
let status = cmd.spawn().unwrap().wait().unwrap();
if !status.success() {
eprintln!("{cmd:?} exited with status {:?}", status);
process::exit(1);
}
}
Expand Down Expand Up @@ -233,6 +235,7 @@ pub(crate) fn spawn_and_wait_with_input(mut cmd: Command, input: String) -> Stri

let output = child.wait_with_output().expect("Failed to read stdout");
if !output.status.success() {
eprintln!("{cmd:?} exited with status {:?}", output.status);
process::exit(1);
}

Expand Down

0 comments on commit 6923b51

Please sign in to comment.