Skip to content

Commit

Permalink
Remove run_quiet
Browse files Browse the repository at this point in the history
  • Loading branch information
Kobzol committed Jun 20, 2024
1 parent a12f541 commit 949e667
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
5 changes: 3 additions & 2 deletions src/bootstrap/src/core/build_steps/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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.
Expand Down
15 changes: 4 additions & 11 deletions src/bootstrap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand All @@ -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 {
Expand Down Expand Up @@ -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),
)
}

Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/utils/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down

0 comments on commit 949e667

Please sign in to comment.