Skip to content

Commit 17011d0

Browse files
committed
Remove usages of Config::try_run
Commands should be run on Builder, if possible.
1 parent 7efe8fa commit 17011d0

File tree

3 files changed

+13
-15
lines changed

3 files changed

+13
-15
lines changed

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

+5-4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ use crate::core::config::flags::Subcommand;
2727
use crate::core::config::TargetSelection;
2828
use crate::utils;
2929
use crate::utils::cache::{Interned, INTERNER};
30+
use crate::utils::exec::BootstrapCommand;
3031
use crate::utils::helpers::{
3132
self, add_link_lib_path, dylib_path, dylib_path_var, output, t, up_to_date,
3233
};
@@ -808,8 +809,8 @@ impl Step for Clippy {
808809

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

811-
#[allow(deprecated)] // Clippy reports errors if it blessed the outputs
812-
if builder.config.try_run(&mut cargo).is_ok() {
812+
// Clippy reports errors if it blessed the outputs
813+
if builder.run_cmd(&mut cargo) {
813814
// The tests succeeded; nothing to do.
814815
return;
815816
}
@@ -3094,7 +3095,7 @@ impl Step for CodegenCranelift {
30943095
.arg("testsuite.extended_sysroot");
30953096
cargo.args(builder.config.test_args());
30963097

3097-
#[allow(deprecated)]
3098-
builder.config.try_run(&mut cargo.into()).unwrap();
3098+
let mut cmd: Command = cargo.into();
3099+
builder.run_cmd(BootstrapCommand::from(&mut cmd).fail_fast());
30993100
}
31003101
}

src/bootstrap/src/core/build_steps/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,

src/bootstrap/src/lib.rs

+6-9
Original file line numberDiff line numberDiff line change
@@ -579,15 +579,12 @@ impl Build {
579579
}
580580

581581
// Save any local changes, but avoid running `git stash pop` if there are none (since it will exit with an error).
582-
#[allow(deprecated)] // diff-index reports the modifications through the exit status
583-
let has_local_modifications = self
584-
.config
585-
.try_run(
586-
Command::new("git")
587-
.args(&["diff-index", "--quiet", "HEAD"])
588-
.current_dir(&absolute_path),
589-
)
590-
.is_err();
582+
// diff-index reports the modifications through the exit status
583+
let has_local_modifications = !self.run_cmd(
584+
Command::new("git")
585+
.args(&["diff-index", "--quiet", "HEAD"])
586+
.current_dir(&absolute_path),
587+
);
591588
if has_local_modifications {
592589
self.run(Command::new("git").args(&["stash", "push"]).current_dir(&absolute_path));
593590
}

0 commit comments

Comments
 (0)