about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEric Huss <eric@huss.org>2022-01-31 20:12:58 -0800
committerGitHub <noreply@github.com>2022-01-31 20:12:58 -0800
commit445fbff6a4d4cd181094cada847651883bd417a1 (patch)
tree3c34bd4aa9d1691b3718b56f06221edac313826a
parent3aa2e4584b16084b157ca7a9914b0dac44d021d0 (diff)
parent9bf6a5de7705e83c110179580e996dcf74a5928f (diff)
downloadrust-445fbff6a4d4cd181094cada847651883bd417a1.tar.gz
rust-445fbff6a4d4cd181094cada847651883bd417a1.zip
Rollup merge of #93492 - Mark-Simulacrum:shorter-failure-output, r=ehuss
Hide failed command unless in verbose mode

This is particularly intended for invoking compiletest; the command line there
is long (3,350 characters on my system) and takes up a lot of screen real estate
for little benefit to the majority of those running bootstrap. This moves
printing it to verbose mode (-v must be passed) which means that it's still
possible to access when needed for debugging.

The main downside is that CI logs will by-default become less usable for
debugging (particularly) spurious failures, but it is pretty rare for us to
really need the information there -- it's usually fairly obvious what is being
run with a little investigation.

r? `@ehuss` as you've done some of the spurious failure investigations, so can
(hopefully) confirm my intuition that this won't seriously hinder them.
-rw-r--r--src/bootstrap/lib.rs4
-rw-r--r--src/build_helper/lib.rs8
2 files changed, 6 insertions, 6 deletions
diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs
index 8569089f701..e5f84d417bf 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 28e95d81bb7..24aded54731 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",