Remove run_cmd

This commit is contained in:
Jakub Beránek 2024-06-22 09:42:07 +02:00
parent 99f77a2eda
commit 903d6a9d89
No known key found for this signature in database
GPG key ID: 909CD0D26483516B
3 changed files with 12 additions and 24 deletions

View file

@ -766,7 +766,7 @@ impl Step for Clippy {
let _guard = builder.msg_sysroot_tool(Kind::Test, compiler.stage, "clippy", host, host);
// Clippy reports errors if it blessed the outputs
if builder.run_cmd(BootstrapCommand::from(&mut cargo).allow_failure()) {
if builder.run_tracked(BootstrapCommand::from(&mut cargo).allow_failure()).is_success() {
// The tests succeeded; nothing to do.
return;
}
@ -3352,7 +3352,7 @@ impl Step for CodegenCranelift {
cargo.args(builder.config.test_args());
let mut cmd: Command = cargo.into();
builder.run_cmd(BootstrapCommand::from(&mut cmd).fail_fast());
builder.run_tracked(BootstrapCommand::from(&mut cmd));
}
}
@ -3478,6 +3478,6 @@ impl Step for CodegenGCC {
cargo.args(builder.config.test_args());
let mut cmd: Command = cargo.into();
builder.run_cmd(BootstrapCommand::from(&mut cmd).fail_fast());
builder.run_tracked(BootstrapCommand::from(&mut cmd));
}
}

View file

@ -9,6 +9,7 @@ use crate::core::builder;
use crate::core::builder::{Builder, Cargo as CargoCommand, RunConfig, ShouldRun, Step};
use crate::core::config::TargetSelection;
use crate::utils::channel::GitInfo;
use crate::utils::exec::BootstrapCommand;
use crate::utils::helpers::output;
use crate::utils::helpers::{add_dylib_path, exe, t};
use crate::Compiler;
@ -917,7 +918,7 @@ impl Step for LibcxxVersionTool {
.arg(&executable)
.arg(builder.src.join("src/tools/libcxx-version/main.cpp"));
builder.run_cmd(&mut cmd);
builder.run_tracked(BootstrapCommand::from(&mut cmd));
if !executable.exists() {
panic!("Something went wrong. {} is not present", executable.display());

View file

@ -580,14 +580,12 @@ impl Build {
// Save any local changes, but avoid running `git stash pop` if there are none (since it will exit with an error).
// diff-index reports the modifications through the exit status
let has_local_modifications = !self.run_cmd(
BootstrapCommand::from(submodule_git().args(["diff-index", "--quiet", "HEAD"]))
.allow_failure()
.output_mode(match self.is_verbose() {
true => OutputMode::All,
false => OutputMode::OnlyOutput,
}),
);
let has_local_modifications = self
.run_tracked(
BootstrapCommand::from(submodule_git().args(["diff-index", "--quiet", "HEAD"]))
.allow_failure(),
)
.is_failure();
if has_local_modifications {
self.run(submodule_git().args(["stash", "push"]));
}
@ -1026,18 +1024,7 @@ impl Build {
/// Runs a command, printing out nice contextual information if it fails.
fn run(&self, cmd: &mut Command) {
self.run_cmd(BootstrapCommand::from(cmd).fail_fast().output_mode(
match self.is_verbose() {
true => OutputMode::All,
false => OutputMode::OnlyOutput,
},
));
}
/// 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 {
let command = cmd.into();
self.run_tracked(command).is_success()
self.run_tracked(BootstrapCommand::from(cmd));
}
/// Check if verbosity is greater than the `level`