Convert run-make/windows-spawn to rmake
This commit is contained in:
parent
f08e00f3d5
commit
e463f6fd0b
3 changed files with 21 additions and 14 deletions
|
|
@ -1,8 +0,0 @@
|
|||
include ../tools.mk
|
||||
|
||||
# only-windows
|
||||
|
||||
all:
|
||||
$(RUSTC) -o "$(TMPDIR)/hopefullydoesntexist bar.exe" hello.rs
|
||||
$(RUSTC) spawn.rs
|
||||
$(TMPDIR)/spawn.exe
|
||||
17
tests/run-make/windows-spawn/rmake.rs
Normal file
17
tests/run-make/windows-spawn/rmake.rs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
//@ only-windows
|
||||
|
||||
use run_make_support::{run, rustc, tmp_dir};
|
||||
|
||||
// On Windows `Command` uses `CreateProcessW` to run a new process.
|
||||
// However, in the past std used to not pass in the application name, leaving
|
||||
// `CreateProcessW` to use heuristics to guess the intended name from the
|
||||
// command line string. Sometimes this could go very wrong.
|
||||
// E.g. in Rust 1.0 `Command::new("foo").arg("bar").spawn()` will try to launch
|
||||
// `foo bar.exe` if foo.exe does not exist. Which is clearly not desired.
|
||||
|
||||
fn main() {
|
||||
let out_dir = tmp_dir();
|
||||
rustc().input("hello.rs").output(out_dir.join("hopefullydoesntexist bar.exe")).run();
|
||||
rustc().input("spawn.rs").run();
|
||||
run("spawn");
|
||||
}
|
||||
|
|
@ -3,10 +3,8 @@ use std::process::Command;
|
|||
|
||||
fn main() {
|
||||
// Make sure it doesn't try to run "hopefullydoesntexist bar.exe".
|
||||
assert_eq!(Command::new("hopefullydoesntexist")
|
||||
.arg("bar")
|
||||
.spawn()
|
||||
.unwrap_err()
|
||||
.kind(),
|
||||
ErrorKind::NotFound);
|
||||
assert_eq!(
|
||||
Command::new("hopefullydoesntexist").arg("bar").spawn().unwrap_err().kind(),
|
||||
ErrorKind::NotFound
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue