Skip to content

Commit 0034ce5

Browse files
committed
Fixup windows-binary-no-external-deps
1 parent ad5dce5 commit 0034ce5

File tree

1 file changed

+12
-6
lines changed
  • tests/run-make/windows-binary-no-external-deps

1 file changed

+12
-6
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
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};
76
use std::env;
87
use std::path::PathBuf;
8+
use std::process::Command;
99

1010
fn 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!\noutput status: `{status}`");
20+
}
1521
}

0 commit comments

Comments
 (0)