fix(xtask): limit test command to a single thread on windows (#4489)

(cherry picked from commit e1f6e38b57)
This commit is contained in:
Will Lillis 2025-06-08 12:39:55 -04:00 committed by Christian Clason
parent 4fcf78cfec
commit ffbe504242

View file

@ -65,13 +65,17 @@ pub fn run(args: &Test) -> Result<()> {
}
if args.g {
let cargo_cmd = Command::new("cargo")
let mut cargo_cmd = Command::new("cargo");
cargo_cmd
.arg("test")
.arg(test_flags)
.arg("--no-run")
.arg("--message-format=json")
.stdout(Stdio::piped())
.spawn()?;
.arg("--message-format=json");
#[cfg(target_os = "windows")]
cargo_cmd.arg("--").arg("--test-threads=1");
let cargo_cmd = cargo_cmd.stdout(Stdio::piped()).spawn()?;
let jq_cmd = Command::new("jq")
.arg("-rs")
@ -97,8 +101,15 @@ pub fn run(args: &Test) -> Result<()> {
cargo_cmd.arg(test_flags);
}
cargo_cmd.args(&args.args);
#[cfg(target_os = "windows")]
cargo_cmd.arg("--").arg("--test-threads=1");
if args.nocapture {
cargo_cmd.arg("--").arg("--nocapture");
#[cfg(not(target_os = "windows"))]
cargo_cmd.arg("--");
cargo_cmd.arg("--nocapture");
}
bail_on_err(
&cargo_cmd.spawn()?.wait_with_output()?,