From c0c6a24f89119848c27eb5267a6cf25dd468c1cb Mon Sep 17 00:00:00 2001 From: jyn Date: Thu, 13 Jul 2023 02:23:13 -0500 Subject: [PATCH] Replace `builder::try_run_quiet` with `run_quiet_delaying_failure` It was only used when a `builder` is available, and I want to encourage using the version that supports `--no-fail-fast`. --- src/bootstrap/lib.rs | 15 ++++++++++++--- src/bootstrap/test.rs | 15 +-------------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index e64cbc0152bb0..518567cc587d9 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -972,12 +972,21 @@ impl Build { /// Runs a command, printing out nice contextual information if it fails. /// Exits if the command failed to execute at all, otherwise returns its /// `status.success()`. - fn try_run_quiet(&self, cmd: &mut Command) -> bool { + fn run_quiet_delaying_failure(&self, cmd: &mut Command) -> bool { if self.config.dry_run() { return true; } - self.verbose(&format!("running: {:?}", cmd)); - try_run_suppressed(cmd) + if !self.fail_fast { + self.verbose(&format!("running: {:?}", cmd)); + if !try_run_suppressed(cmd) { + let mut failures = self.delayed_failures.borrow_mut(); + failures.push(format!("{:?}", cmd)); + return false; + } + } else { + self.run_quiet(cmd); + } + true } /// Runs a command, printing out contextual info if it fails, and delaying errors until the build finishes. diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 3852c92d7284d..f63f75aca5bb3 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -48,19 +48,6 @@ const MIR_OPT_BLESS_TARGET_MAPPING: &[(&str, &str)] = &[ // build for, so there is no entry for "aarch64-apple-darwin" here. ]; -fn try_run_quiet(builder: &Builder<'_>, cmd: &mut Command) -> bool { - if !builder.fail_fast { - if !builder.try_run_quiet(cmd) { - let mut failures = builder.delayed_failures.borrow_mut(); - failures.push(format!("{:?}", cmd)); - return false; - } - } else { - builder.run_quiet(cmd); - } - true -} - #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub struct CrateBootstrap { path: Interned, @@ -2134,7 +2121,7 @@ fn markdown_test(builder: &Builder<'_>, compiler: Compiler, markdown: &Path) -> if builder.config.verbose_tests { builder.run_delaying_failure(&mut cmd) } else { - try_run_quiet(builder, &mut cmd) + builder.run_quiet_delaying_failure(&mut cmd) } }