From 02e5f387fad115d172ef09697faffd8a4b90b29f Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Thu, 7 Sep 2023 13:36:03 +0000 Subject: [PATCH] Add debug tracing for failed commands --- build_system/utils.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/build_system/utils.rs b/build_system/utils.rs index 24624cdeab1..9f5e37db35e 100644 --- a/build_system/utils.rs +++ b/build_system/utils.rs @@ -197,7 +197,9 @@ pub(crate) fn try_hard_link(src: impl AsRef, dst: impl AsRef) { #[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); } } @@ -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); }