Skip to content

Commit e933cfb

Browse files
committed
Remove run_quiet_delaying_failure
1 parent 949e667 commit e933cfb

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

src/bootstrap/src/core/build_steps/test.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -2342,11 +2342,11 @@ fn markdown_test(builder: &Builder<'_>, compiler: Compiler, markdown: &Path) ->
23422342
let test_args = builder.config.test_args().join(" ");
23432343
cmd.arg("--test-args").arg(test_args);
23442344

2345-
if builder.config.verbose_tests {
2346-
builder.run_delaying_failure(&mut cmd)
2347-
} else {
2348-
builder.run_quiet_delaying_failure(&mut cmd)
2345+
let mut cmd = BootstrapCommand::from(&mut cmd).delay_failure();
2346+
if !builder.config.verbose_tests {
2347+
cmd = cmd.quiet();
23492348
}
2349+
builder.run_tracked(cmd).is_success()
23502350
}
23512351

23522352
#[derive(Debug, Clone, PartialEq, Eq, Hash)]

src/bootstrap/src/lib.rs

+1-9
Original file line numberDiff line numberDiff line change
@@ -958,6 +958,7 @@ impl Build {
958958
})
959959
}
960960

961+
/// Execute a command and return its output.
961962
fn run_tracked(&self, command: BootstrapCommand<'_>) -> CommandOutput {
962963
if self.config.dry_run() {
963964
return CommandOutput::default();
@@ -1037,15 +1038,6 @@ impl Build {
10371038
))
10381039
}
10391040

1040-
/// Runs a command, printing out nice contextual information if it fails.
1041-
/// Exits if the command failed to execute at all, otherwise returns its
1042-
/// `status.success()`.
1043-
fn run_quiet_delaying_failure(&self, cmd: &mut Command) -> bool {
1044-
self.run_cmd(
1045-
BootstrapCommand::from(cmd).delay_failure().output_mode(OutputMode::PrintOnFailure),
1046-
)
1047-
}
1048-
10491041
/// A centralized function for running commands that do not return output.
10501042
pub(crate) fn run_cmd<'a, C: Into<BootstrapCommand<'a>>>(&self, cmd: C) -> bool {
10511043
if self.config.dry_run() {

src/bootstrap/src/utils/exec.rs

+5
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ impl<'a> BootstrapCommand<'a> {
4444
Self { failure_behavior: BehaviorOnFailure::Ignore, ..self }
4545
}
4646

47+
/// Do not print the output of the command, unless it fails.
48+
pub fn quiet(self) -> Self {
49+
self.output_mode(OutputMode::PrintOnFailure)
50+
}
51+
4752
pub fn output_mode(self, output_mode: OutputMode) -> Self {
4853
Self { output_mode, ..self }
4954
}

0 commit comments

Comments
 (0)