Skip to content

Commit

Permalink
Replace builder::try_run_quiet with run_quiet_delaying_failure
Browse files Browse the repository at this point in the history
It was only used when a `builder` is available, and I want to encourage using the version that supports `--no-fail-fast`.
  • Loading branch information
jyn514 committed Jul 15, 2023
1 parent 78f51a4 commit c0c6a24
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
15 changes: 12 additions & 3 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
15 changes: 1 addition & 14 deletions src/bootstrap/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<PathBuf>,
Expand Down Expand Up @@ -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)
}
}

Expand Down

0 comments on commit c0c6a24

Please sign in to comment.