From 949e667d3fc97770134aaa5ea23be4972fde91ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Thu, 20 Jun 2024 11:40:15 +0200 Subject: [PATCH] Remove `run_quiet` --- src/bootstrap/src/core/build_steps/test.rs | 5 +++-- src/bootstrap/src/lib.rs | 15 ++++----------- src/bootstrap/src/utils/exec.rs | 2 +- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index 445096e9786d4..834257a6e21c1 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -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. diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs index b53f054c18740..5b2913b1a83f6 100644 --- a/src/bootstrap/src/lib.rs +++ b/src/bootstrap/src/lib.rs @@ -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 { diff --git a/src/bootstrap/src/utils/exec.rs b/src/bootstrap/src/utils/exec.rs index e7dedfa99f2c2..21013345f0914 100644 --- a/src/bootstrap/src/utils/exec.rs +++ b/src/bootstrap/src/utils/exec.rs @@ -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`.