mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
Remove run_quiet_delaying_failure
This commit is contained in:
parent
949e667d3f
commit
e933cfb13c
@ -2342,11 +2342,11 @@ fn markdown_test(builder: &Builder<'_>, compiler: Compiler, markdown: &Path) ->
|
||||
let test_args = builder.config.test_args().join(" ");
|
||||
cmd.arg("--test-args").arg(test_args);
|
||||
|
||||
if builder.config.verbose_tests {
|
||||
builder.run_delaying_failure(&mut cmd)
|
||||
} else {
|
||||
builder.run_quiet_delaying_failure(&mut cmd)
|
||||
let mut cmd = BootstrapCommand::from(&mut cmd).delay_failure();
|
||||
if !builder.config.verbose_tests {
|
||||
cmd = cmd.quiet();
|
||||
}
|
||||
builder.run_tracked(cmd).is_success()
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
|
@ -958,6 +958,7 @@ impl Build {
|
||||
})
|
||||
}
|
||||
|
||||
/// Execute a command and return its output.
|
||||
fn run_tracked(&self, command: BootstrapCommand<'_>) -> CommandOutput {
|
||||
if self.config.dry_run() {
|
||||
return CommandOutput::default();
|
||||
@ -1037,15 +1038,6 @@ 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 run_quiet_delaying_failure(&self, cmd: &mut Command) -> bool {
|
||||
self.run_cmd(
|
||||
BootstrapCommand::from(cmd).delay_failure().output_mode(OutputMode::PrintOnFailure),
|
||||
)
|
||||
}
|
||||
|
||||
/// A centralized function for running commands that do not return output.
|
||||
pub(crate) fn run_cmd<'a, C: Into<BootstrapCommand<'a>>>(&self, cmd: C) -> bool {
|
||||
if self.config.dry_run() {
|
||||
|
@ -44,6 +44,11 @@ impl<'a> BootstrapCommand<'a> {
|
||||
Self { failure_behavior: BehaviorOnFailure::Ignore, ..self }
|
||||
}
|
||||
|
||||
/// Do not print the output of the command, unless it fails.
|
||||
pub fn quiet(self) -> Self {
|
||||
self.output_mode(OutputMode::PrintOnFailure)
|
||||
}
|
||||
|
||||
pub fn output_mode(self, output_mode: OutputMode) -> Self {
|
||||
Self { output_mode, ..self }
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user