diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 8569089f70128..e5f84d417bf0b 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -851,7 +851,7 @@ impl Build { return; } self.verbose(&format!("running: {:?}", cmd)); - run(cmd) + run(cmd, self.is_verbose()) } /// Runs a command, printing out nice contextual information if it fails. @@ -871,7 +871,7 @@ impl Build { return true; } self.verbose(&format!("running: {:?}", cmd)); - try_run(cmd) + try_run(cmd, self.is_verbose()) } /// Runs a command, printing out nice contextual information if it fails. diff --git a/src/build_helper/lib.rs b/src/build_helper/lib.rs index 28e95d81bb7e4..24aded547315e 100644 --- a/src/build_helper/lib.rs +++ b/src/build_helper/lib.rs @@ -55,18 +55,18 @@ pub fn restore_library_path() { } } -pub fn run(cmd: &mut Command) { - if !try_run(cmd) { +pub fn run(cmd: &mut Command, print_cmd_on_fail: bool) { + if !try_run(cmd, print_cmd_on_fail) { std::process::exit(1); } } -pub fn try_run(cmd: &mut Command) -> bool { +pub fn try_run(cmd: &mut Command, print_cmd_on_fail: bool) -> bool { let status = match cmd.status() { Ok(status) => status, Err(e) => fail(&format!("failed to execute command: {:?}\nerror: {}", cmd, e)), }; - if !status.success() { + if !status.success() && print_cmd_on_fail { println!( "\n\ncommand did not execute successfully: {:?}\n\ expected success, got: {}\n\n",