Skip to content

Commit b2f121c

Browse files
committed
Remove usages of Config::try_run
Commands should be run on Builder, if possible.
1 parent 3c01747 commit b2f121c

File tree

3 files changed

+13
-15
lines changed

3 files changed

+13
-15
lines changed

src/bootstrap/lib.rs

+6-9
Original file line numberDiff line numberDiff line change
@@ -629,15 +629,12 @@ impl Build {
629629
}
630630

631631
// Save any local changes, but avoid running `git stash pop` if there are none (since it will exit with an error).
632-
#[allow(deprecated)] // diff-index reports the modifications through the exit status
633-
let has_local_modifications = self
634-
.config
635-
.try_run(
636-
Command::new("git")
637-
.args(&["diff-index", "--quiet", "HEAD"])
638-
.current_dir(&absolute_path),
639-
)
640-
.is_err();
632+
// diff-index reports the modifications through the exit status
633+
let has_local_modifications = !self.run_cmd(
634+
Command::new("git")
635+
.args(&["diff-index", "--quiet", "HEAD"])
636+
.current_dir(&absolute_path),
637+
);
641638
if has_local_modifications {
642639
self.run(Command::new("git").args(&["stash", "push"]).current_dir(&absolute_path));
643640
}

src/bootstrap/test.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ use crate::compile;
2121
use crate::config::TargetSelection;
2222
use crate::dist;
2323
use crate::doc::DocumentationFormat;
24+
use crate::exec::BootstrapCommand;
2425
use crate::flags::Subcommand;
2526
use crate::llvm;
2627
use crate::render_tests::add_flags_and_try_run_tests;
@@ -801,8 +802,8 @@ impl Step for Clippy {
801802

802803
let _guard = builder.msg_sysroot_tool(Kind::Test, compiler.stage, "clippy", host, host);
803804

804-
#[allow(deprecated)] // Clippy reports errors if it blessed the outputs
805-
if builder.config.try_run(&mut cargo).is_ok() {
805+
// Clippy reports errors if it blessed the outputs
806+
if builder.run_cmd(&mut cargo) {
806807
// The tests succeeded; nothing to do.
807808
return;
808809
}
@@ -3087,7 +3088,7 @@ impl Step for CodegenCranelift {
30873088
.arg("testsuite.extended_sysroot");
30883089
cargo.args(builder.config.test_args());
30893090

3090-
#[allow(deprecated)]
3091-
builder.config.try_run(&mut cargo.into()).unwrap();
3091+
let mut cmd: Command = cargo.into();
3092+
builder.run_cmd(BootstrapCommand::from(&mut cmd).fail_fast());
30923093
}
30933094
}

src/bootstrap/tool.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ impl Step for ToolBuild {
108108
);
109109

110110
let mut cargo = Command::from(cargo);
111-
#[allow(deprecated)] // we check this in `is_optional_tool` in a second
112-
let is_expected = builder.config.try_run(&mut cargo).is_ok();
111+
// we check this in `is_optional_tool` in a second
112+
let is_expected = builder.run_cmd(&mut cargo);
113113

114114
builder.save_toolstate(
115115
tool,

0 commit comments

Comments
 (0)