Rename Supress variant

This commit is contained in:
Jakub Beránek 2023-10-11 19:00:35 +02:00
parent 17011d02ea
commit 03d48dd735
No known key found for this signature in database
GPG key ID: 909CD0D26483516B
2 changed files with 9 additions and 5 deletions

View file

@ -937,14 +937,18 @@ 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::Suppress));
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::Suppress))
self.run_cmd(
BootstrapCommand::from(cmd).delay_failure().output_mode(OutputMode::SuppressOnSuccess),
)
}
/// A centralized function for running commands that do not return output.
@ -965,7 +969,7 @@ impl Build {
}),
matches!(mode, OutputMode::PrintAll),
),
OutputMode::Suppress => (command.command.output(), true),
OutputMode::SuppressOnSuccess => (command.command.output(), true),
};
let output = match output {

View file

@ -18,7 +18,7 @@ pub enum OutputMode {
/// Print the output (by inheriting stdout/stderr).
PrintOutput,
/// Suppress the output if the command succeeds, otherwise print the output.
Suppress,
SuppressOnSuccess,
}
/// Wrapper around `std::process::Command`.
@ -43,6 +43,6 @@ impl<'a> BootstrapCommand<'a> {
impl<'a> From<&'a mut Command> for BootstrapCommand<'a> {
fn from(command: &'a mut Command) -> Self {
Self { command, failure_behavior: None, output_mode: OutputMode::Suppress }
Self { command, failure_behavior: None, output_mode: OutputMode::SuppressOnSuccess }
}
}