Skip to content

Commit e463f6f

Browse files
committed
Convert run-make/windows-spawn to rmake
1 parent f08e00f commit e463f6f

File tree

3 files changed

+21
-14
lines changed

3 files changed

+21
-14
lines changed

tests/run-make/windows-spawn/Makefile

-8
This file was deleted.

tests/run-make/windows-spawn/rmake.rs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//@ only-windows
2+
3+
use run_make_support::{run, rustc, tmp_dir};
4+
5+
// On Windows `Command` uses `CreateProcessW` to run a new process.
6+
// However, in the past std used to not pass in the application name, leaving
7+
// `CreateProcessW` to use heuristics to guess the intended name from the
8+
// command line string. Sometimes this could go very wrong.
9+
// E.g. in Rust 1.0 `Command::new("foo").arg("bar").spawn()` will try to launch
10+
// `foo bar.exe` if foo.exe does not exist. Which is clearly not desired.
11+
12+
fn main() {
13+
let out_dir = tmp_dir();
14+
rustc().input("hello.rs").output(out_dir.join("hopefullydoesntexist bar.exe")).run();
15+
rustc().input("spawn.rs").run();
16+
run("spawn");
17+
}

tests/run-make/windows-spawn/spawn.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@ use std::process::Command;
33

44
fn main() {
55
// Make sure it doesn't try to run "hopefullydoesntexist bar.exe".
6-
assert_eq!(Command::new("hopefullydoesntexist")
7-
.arg("bar")
8-
.spawn()
9-
.unwrap_err()
10-
.kind(),
11-
ErrorKind::NotFound);
6+
assert_eq!(
7+
Command::new("hopefullydoesntexist").arg("bar").spawn().unwrap_err().kind(),
8+
ErrorKind::NotFound
9+
)
1210
}

0 commit comments

Comments
 (0)