Skip to content

Commit 445fbff

Browse files
authored
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.
2 parents 3aa2e45 + 9bf6a5d commit 445fbff

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Diff for: src/bootstrap/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,7 @@ impl Build {
851851
return;
852852
}
853853
self.verbose(&format!("running: {:?}", cmd));
854-
run(cmd)
854+
run(cmd, self.is_verbose())
855855
}
856856

857857
/// Runs a command, printing out nice contextual information if it fails.
@@ -871,7 +871,7 @@ impl Build {
871871
return true;
872872
}
873873
self.verbose(&format!("running: {:?}", cmd));
874-
try_run(cmd)
874+
try_run(cmd, self.is_verbose())
875875
}
876876

877877
/// Runs a command, printing out nice contextual information if it fails.

Diff for: src/build_helper/lib.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,18 @@ pub fn restore_library_path() {
5555
}
5656
}
5757

58-
pub fn run(cmd: &mut Command) {
59-
if !try_run(cmd) {
58+
pub fn run(cmd: &mut Command, print_cmd_on_fail: bool) {
59+
if !try_run(cmd, print_cmd_on_fail) {
6060
std::process::exit(1);
6161
}
6262
}
6363

64-
pub fn try_run(cmd: &mut Command) -> bool {
64+
pub fn try_run(cmd: &mut Command, print_cmd_on_fail: bool) -> bool {
6565
let status = match cmd.status() {
6666
Ok(status) => status,
6767
Err(e) => fail(&format!("failed to execute command: {:?}\nerror: {}", cmd, e)),
6868
};
69-
if !status.success() {
69+
if !status.success() && print_cmd_on_fail {
7070
println!(
7171
"\n\ncommand did not execute successfully: {:?}\n\
7272
expected success, got: {}\n\n",

0 commit comments

Comments
 (0)