File tree 3 files changed +21
-14
lines changed
tests/run-make/windows-spawn
3 files changed +21
-14
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change @@ -3,10 +3,8 @@ use std::process::Command;
3
3
4
4
fn main ( ) {
5
5
// 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
+ )
12
10
}
You can’t perform that action at this time.
0 commit comments