File tree Expand file tree Collapse file tree 2 files changed +21
-9
lines changed
tests/run-make/windows-binary-no-external-deps Expand file tree Collapse file tree 2 files changed +21
-9
lines changed Load Diff This file was deleted.
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`.
3+ //@ only-windows
4+
5+ use run_make_support:: { rustc, tmp_dir} ;
6+ use std:: env;
7+ use std:: path:: PathBuf ;
8+ use std:: process:: Command ;
9+
10+ fn main ( ) {
11+ rustc ( ) . input ( "hello.rs" ) . run ( ) ;
12+
13+ let windows_dir = env:: var ( "SystemRoot" ) . unwrap ( ) ;
14+ let system32: PathBuf = [ & windows_dir, "System32" ] . iter ( ) . collect ( ) ;
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+ }
21+ }
You can’t perform that action at this time.
0 commit comments