Remove usages of Config::try_run

Commands should be run on Builder, if possible.
This commit is contained in:
Jakub Beránek 2023-10-09 23:42:13 +02:00
parent 7efe8fa849
commit 17011d02ea
No known key found for this signature in database
GPG key ID: 909CD0D26483516B
3 changed files with 13 additions and 15 deletions

View file

@ -27,6 +27,7 @@ use crate::core::config::flags::Subcommand;
use crate::core::config::TargetSelection;
use crate::utils;
use crate::utils::cache::{Interned, INTERNER};
use crate::utils::exec::BootstrapCommand;
use crate::utils::helpers::{
self, add_link_lib_path, dylib_path, dylib_path_var, output, t, up_to_date,
};
@ -808,8 +809,8 @@ impl Step for Clippy {
let _guard = builder.msg_sysroot_tool(Kind::Test, compiler.stage, "clippy", host, host);
#[allow(deprecated)] // Clippy reports errors if it blessed the outputs
if builder.config.try_run(&mut cargo).is_ok() {
// Clippy reports errors if it blessed the outputs
if builder.run_cmd(&mut cargo) {
// The tests succeeded; nothing to do.
return;
}
@ -3094,7 +3095,7 @@ impl Step for CodegenCranelift {
.arg("testsuite.extended_sysroot");
cargo.args(builder.config.test_args());
#[allow(deprecated)]
builder.config.try_run(&mut cargo.into()).unwrap();
let mut cmd: Command = cargo.into();
builder.run_cmd(BootstrapCommand::from(&mut cmd).fail_fast());
}
}

View file

@ -108,8 +108,8 @@ impl Step for ToolBuild {
);
let mut cargo = Command::from(cargo);
#[allow(deprecated)] // we check this in `is_optional_tool` in a second
let is_expected = builder.config.try_run(&mut cargo).is_ok();
// we check this in `is_optional_tool` in a second
let is_expected = builder.run_cmd(&mut cargo);
builder.save_toolstate(
tool,

View file

@ -579,15 +579,12 @@ impl Build {
}
// Save any local changes, but avoid running `git stash pop` if there are none (since it will exit with an error).
#[allow(deprecated)] // diff-index reports the modifications through the exit status
let has_local_modifications = self
.config
.try_run(
Command::new("git")
.args(&["diff-index", "--quiet", "HEAD"])
.current_dir(&absolute_path),
)
.is_err();
// diff-index reports the modifications through the exit status
let has_local_modifications = !self.run_cmd(
Command::new("git")
.args(&["diff-index", "--quiet", "HEAD"])
.current_dir(&absolute_path),
);
if has_local_modifications {
self.run(Command::new("git").args(&["stash", "push"]).current_dir(&absolute_path));
}