Remove run_quiet

This commit is contained in:
Jakub Beránek 2024-06-20 11:40:15 +02:00
parent a12f541a18
commit 949e667d3f
3 changed files with 8 additions and 14 deletions

View file

@ -26,7 +26,7 @@ use crate::core::builder::{Builder, Compiler, Kind, RunConfig, ShouldRun, Step};
use crate::core::config::flags::get_completion;
use crate::core::config::flags::Subcommand;
use crate::core::config::TargetSelection;
use crate::utils::exec::BootstrapCommand;
use crate::utils::exec::{BootstrapCommand, OutputMode};
use crate::utils::helpers::{
self, add_link_lib_path, add_rustdoc_cargo_linker_args, dylib_path, dylib_path_var,
linker_args, linker_flags, output, t, target_supports_cranelift_backend, up_to_date,
@ -2312,7 +2312,8 @@ impl Step for ErrorIndex {
let guard =
builder.msg(Kind::Test, compiler.stage, "error-index", compiler.host, compiler.host);
let _time = helpers::timeit(builder);
builder.run_quiet(&mut tool);
builder
.run_tracked(BootstrapCommand::from(&mut tool).output_mode(OutputMode::PrintOnFailure));
drop(guard);
// The tests themselves need to link to std, so make sure it is
// available.

View file

@ -958,7 +958,7 @@ impl Build {
})
}
fn run_tracked(&self, command: BootstrapCommand) -> CommandOutput {
fn run_tracked(&self, command: BootstrapCommand<'_>) -> CommandOutput {
if self.config.dry_run() {
return CommandOutput::default();
}
@ -970,7 +970,7 @@ impl Build {
command.command.status().map(|status| status.into()),
matches!(mode, OutputMode::PrintAll),
),
OutputMode::SuppressOnSuccess => (command.command.output().map(|o| o.into()), true),
OutputMode::PrintOnFailure => (command.command.output().map(|o| o.into()), true),
};
let output = match output {
@ -1037,19 +1037,12 @@ impl Build {
))
}
/// Runs a command, printing out nice contextual information if it fails.
fn run_quiet(&self, cmd: &mut Command) {
self.run_cmd(
BootstrapCommand::from(cmd).fail_fast().output_mode(OutputMode::SuppressOnSuccess),
);
}
/// 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::SuppressOnSuccess),
BootstrapCommand::from(cmd).delay_failure().output_mode(OutputMode::PrintOnFailure),
)
}
@ -1071,7 +1064,7 @@ impl Build {
}),
matches!(mode, OutputMode::PrintAll),
),
OutputMode::SuppressOnSuccess => (command.command.output(), true),
OutputMode::PrintOnFailure => (command.command.output(), true),
};
let output = match output {

View file

@ -20,7 +20,7 @@ pub enum OutputMode {
/// Print the output (by inheriting stdout/stderr).
PrintOutput,
/// Suppress the output if the command succeeds, otherwise print the output.
SuppressOnSuccess,
PrintOnFailure,
}
/// Wrapper around `std::process::Command`.