File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed
tests/run-make/windows-binary-no-external-deps Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change 1+ //! Ensure that we aren't relying on any non-system DLLs when running
2+ //! a "hello world" application by setting `PATH` to `C:\Windows\System32`.
13//@ only-windows
24
3- // Ensure that we aren't relying on any non-system DLLs when compiling and running
4- // a "hello world" application by setting `PATH` to `C:\Windows\System32`.
5-
6- use run_make_support:: { run, rustc} ;
5+ use run_make_support:: { rustc, tmp_dir} ;
76use std:: env;
87use std:: path:: PathBuf ;
8+ use std:: process:: Command ;
99
1010fn main ( ) {
11+ rustc ( ) . input ( "hello.rs" ) . run ( ) ;
12+
1113 let windows_dir = env:: var ( "SystemRoot" ) . unwrap ( ) ;
1214 let system32: PathBuf = [ & windows_dir, "System32" ] . iter ( ) . collect ( ) ;
13- rustc ( ) . input ( "hello.rs" ) . env ( "PATH" , system32) . run ( ) ;
14- run ( "hello" ) ;
15+ // Note: This does not use the support wrappers so that we can precisely control the PATH
16+ let exe = tmp_dir ( ) . join ( "hello.exe" ) ;
17+ let status = Command :: new ( exe) . env ( "PATH" , & system32) . spawn ( ) . unwrap ( ) . wait ( ) . unwrap ( ) ;
18+ if !status. success ( ) {
19+ panic ! ( "Command failed!\n output status: `{status}`" ) ;
20+ }
1521}
You can’t perform that action at this time.
0 commit comments