Migrate more Command usages to BootstrapCmd

This commit is contained in:
Jakub Beránek 2024-06-22 11:35:03 +02:00
parent bed2cbd2ce
commit 2ebfccecd0
No known key found for this signature in database
GPG key ID: 909CD0D26483516B
5 changed files with 17 additions and 20 deletions

View file

@ -1705,7 +1705,7 @@ fn filter(contents: &str, marker: &str) -> String {
let heat_flags = ["-nologo", "-gg", "-sfrag", "-srd", "-sreg"];
builder.run(
Command::new(&heat)
BootstrapCommand::new(&heat)
.current_dir(&exe)
.arg("dir")
.arg("rustc")
@ -1721,7 +1721,7 @@ fn filter(contents: &str, marker: &str) -> String {
);
if built_tools.contains("rust-docs") {
builder.run(
Command::new(&heat)
BootstrapCommand::new(&heat)
.current_dir(&exe)
.arg("dir")
.arg("rust-docs")
@ -1739,7 +1739,7 @@ fn filter(contents: &str, marker: &str) -> String {
);
}
builder.run(
Command::new(&heat)
BootstrapCommand::new(&heat)
.current_dir(&exe)
.arg("dir")
.arg("cargo")
@ -1756,7 +1756,7 @@ fn filter(contents: &str, marker: &str) -> String {
.arg(etc.join("msi/remove-duplicates.xsl")),
);
builder.run(
Command::new(&heat)
BootstrapCommand::new(&heat)
.current_dir(&exe)
.arg("dir")
.arg("rust-std")
@ -1772,7 +1772,7 @@ fn filter(contents: &str, marker: &str) -> String {
);
if built_tools.contains("rust-analyzer") {
builder.run(
Command::new(&heat)
BootstrapCommand::new(&heat)
.current_dir(&exe)
.arg("dir")
.arg("rust-analyzer")
@ -1791,7 +1791,7 @@ fn filter(contents: &str, marker: &str) -> String {
}
if built_tools.contains("clippy") {
builder.run(
Command::new(&heat)
BootstrapCommand::new(&heat)
.current_dir(&exe)
.arg("dir")
.arg("clippy")
@ -1810,7 +1810,7 @@ fn filter(contents: &str, marker: &str) -> String {
}
if built_tools.contains("miri") {
builder.run(
Command::new(&heat)
BootstrapCommand::new(&heat)
.current_dir(&exe)
.arg("dir")
.arg("miri")
@ -1828,7 +1828,7 @@ fn filter(contents: &str, marker: &str) -> String {
);
}
builder.run(
Command::new(&heat)
BootstrapCommand::new(&heat)
.current_dir(&exe)
.arg("dir")
.arg("rust-analysis")
@ -1846,7 +1846,7 @@ fn filter(contents: &str, marker: &str) -> String {
);
if target.ends_with("windows-gnu") {
builder.run(
Command::new(&heat)
BootstrapCommand::new(&heat)
.current_dir(&exe)
.arg("dir")
.arg("rust-mingw")

View file

@ -3142,8 +3142,7 @@ fn run(self, builder: &Builder<'_>) {
return;
}
let mut cmd =
std::process::Command::new(builder.src.join("src/tools/rust-installer/test.sh"));
let mut cmd = BootstrapCommand::new(builder.src.join("src/tools/rust-installer/test.sh"));
let tmpdir = testdir(builder, compiler.host).join("rust-installer");
let _ = std::fs::remove_dir_all(&tmpdir);
let _ = std::fs::create_dir_all(&tmpdir);
@ -3152,7 +3151,7 @@ fn run(self, builder: &Builder<'_>) {
cmd.env("CARGO", &builder.initial_cargo);
cmd.env("RUSTC", &builder.initial_rustc);
cmd.env("TMP_DIR", &tmpdir);
builder.run(BootstrapCommand::from(&mut cmd).delay_failure());
builder.run(cmd.delay_failure());
}
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
@ -3346,8 +3345,7 @@ fn run(self, builder: &Builder<'_>) {
.arg("testsuite.extended_sysroot");
cargo.args(builder.config.test_args());
let mut cmd: Command = cargo.into();
builder.run(BootstrapCommand::from(&mut cmd));
builder.run(cargo);
}
}
@ -3472,7 +3470,6 @@ fn run(self, builder: &Builder<'_>) {
.arg("--std-tests");
cargo.args(builder.config.test_args());
let mut cmd: Command = cargo.into();
builder.run(BootstrapCommand::from(&mut cmd));
builder.run(cargo);
}
}

View file

@ -912,13 +912,13 @@ fn run(self, builder: &Builder<'_>) -> LibcxxVersion {
}
let compiler = builder.cxx(self.target).unwrap();
let mut cmd = Command::new(compiler);
let mut cmd = BootstrapCommand::new(compiler);
cmd.arg("-o")
.arg(&executable)
.arg(builder.src.join("src/tools/libcxx-version/main.cpp"));
builder.run(BootstrapCommand::from(&mut cmd));
builder.run(cmd);
if !executable.exists() {
panic!("Something went wrong. {} is not present", executable.display());

View file

@ -1,6 +1,6 @@
use crate::core::builder::{Builder, RunConfig, ShouldRun, Step};
use std::path::{Path, PathBuf};
use crate::utils::exec::BootstrapCommand;
use std::path::{Path, PathBuf};
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
pub(crate) struct Vendor {

View file

@ -575,7 +575,7 @@ pub(crate) fn update_submodule(&self, relative_path: &Path) {
};
// NOTE: doesn't use `try_run` because this shouldn't print an error if it fails.
if !update(true).status().map_or(false, |status| status.success()) {
self.run(&mut update(false));
self.run(update(false));
}
// Save any local changes, but avoid running `git stash pop` if there are none (since it will exit with an error).