Skip to content

Commit 591d335

Browse files
committed
Remove run_cmd
1 parent 250586c commit 591d335

File tree

3 files changed

+12
-24
lines changed

3 files changed

+12
-24
lines changed

src/bootstrap/src/core/build_steps/test.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,7 @@ impl Step for Clippy {
766766
let _guard = builder.msg_sysroot_tool(Kind::Test, compiler.stage, "clippy", host, host);
767767

768768
// Clippy reports errors if it blessed the outputs
769-
if builder.run_cmd(BootstrapCommand::from(&mut cargo).allow_failure()) {
769+
if builder.run_tracked(BootstrapCommand::from(&mut cargo).allow_failure()).is_success() {
770770
// The tests succeeded; nothing to do.
771771
return;
772772
}
@@ -3351,7 +3351,7 @@ impl Step for CodegenCranelift {
33513351
cargo.args(builder.config.test_args());
33523352

33533353
let mut cmd: Command = cargo.into();
3354-
builder.run_cmd(BootstrapCommand::from(&mut cmd).fail_fast());
3354+
builder.run_tracked(BootstrapCommand::from(&mut cmd));
33553355
}
33563356
}
33573357

@@ -3477,6 +3477,6 @@ impl Step for CodegenGCC {
34773477
cargo.args(builder.config.test_args());
34783478

34793479
let mut cmd: Command = cargo.into();
3480-
builder.run_cmd(BootstrapCommand::from(&mut cmd).fail_fast());
3480+
builder.run_tracked(BootstrapCommand::from(&mut cmd));
34813481
}
34823482
}

src/bootstrap/src/core/build_steps/tool.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use crate::core::builder;
99
use crate::core::builder::{Builder, Cargo as CargoCommand, RunConfig, ShouldRun, Step};
1010
use crate::core::config::TargetSelection;
1111
use crate::utils::channel::GitInfo;
12+
use crate::utils::exec::BootstrapCommand;
1213
use crate::utils::helpers::output;
1314
use crate::utils::helpers::{add_dylib_path, exe, t};
1415
use crate::Compiler;
@@ -841,7 +842,7 @@ impl Step for LibcxxVersionTool {
841842
.arg(&executable)
842843
.arg(builder.src.join("src/tools/libcxx-version/main.cpp"));
843844

844-
builder.run_cmd(&mut cmd);
845+
builder.run_tracked(BootstrapCommand::from(&mut cmd));
845846

846847
if !executable.exists() {
847848
panic!("Something went wrong. {} is not present", executable.display());

src/bootstrap/src/lib.rs

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -581,14 +581,12 @@ impl Build {
581581

582582
// Save any local changes, but avoid running `git stash pop` if there are none (since it will exit with an error).
583583
// diff-index reports the modifications through the exit status
584-
let has_local_modifications = !self.run_cmd(
585-
BootstrapCommand::from(submodule_git().args(["diff-index", "--quiet", "HEAD"]))
586-
.allow_failure()
587-
.output_mode(match self.is_verbose() {
588-
true => OutputMode::All,
589-
false => OutputMode::OnlyOutput,
590-
}),
591-
);
584+
let has_local_modifications = self
585+
.run_tracked(
586+
BootstrapCommand::from(submodule_git().args(["diff-index", "--quiet", "HEAD"]))
587+
.allow_failure(),
588+
)
589+
.is_failure();
592590
if has_local_modifications {
593591
self.run(submodule_git().args(["stash", "push"]));
594592
}
@@ -1024,18 +1022,7 @@ impl Build {
10241022

10251023
/// Runs a command, printing out nice contextual information if it fails.
10261024
fn run(&self, cmd: &mut Command) {
1027-
self.run_cmd(BootstrapCommand::from(cmd).fail_fast().output_mode(
1028-
match self.is_verbose() {
1029-
true => OutputMode::All,
1030-
false => OutputMode::OnlyOutput,
1031-
},
1032-
));
1033-
}
1034-
1035-
/// A centralized function for running commands that do not return output.
1036-
pub(crate) fn run_cmd<'a, C: Into<BootstrapCommand<'a>>>(&self, cmd: C) -> bool {
1037-
let command = cmd.into();
1038-
self.run_tracked(command).is_success()
1025+
self.run_tracked(BootstrapCommand::from(cmd));
10391026
}
10401027

10411028
/// Check if verbosity is greater than the `level`

0 commit comments

Comments
 (0)