Skip to content

Commit 7cfea30

Browse files
committed
Specify PATH for executables on Windows
1 parent 91a2e57 commit 7cfea30

File tree

1 file changed

+12
-2
lines changed
  • src/tools/run-make-support/src

1 file changed

+12
-2
lines changed

src/tools/run-make-support/src/lib.rs

+12-2
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ impl AuxBuildInvocationBuilder {
8989
}
9090

9191
fn run_common(bin_name: &str) -> (Command, Output) {
92-
let bin_name = if std::env::var("TARGET").unwrap().contains("windows") {
92+
let target = std::env::var("TARGET").unwrap();
93+
94+
let bin_name = if target.contains("windows") {
9395
format!("{}.exe", bin_name)
9496
} else {
9597
bin_name.to_owned()
@@ -104,11 +106,19 @@ fn run_common(bin_name: &str) -> (Command, Output) {
104106
let mut target_rpath_env_path = String::new();
105107
target_rpath_env_path.push_str(&std::env::var("TMPDIR").unwrap());
106108
target_rpath_env_path.push(':');
107-
target_rpath_env_path.push_str(&std::env::var("TARGET_RPATH_DIR").unwrap());
109+
target_rpath_env_path.push_str(&std::env::var("TARGET_RPATH_ENV").unwrap());
108110
target_rpath_env_path.push(':');
109111
target_rpath_env_path.push_str(&std::env::var(&ld_lib_path_envvar).unwrap());
110112
target_rpath_env_path
111113
});
114+
115+
if target.contains("windows") {
116+
let mut path = std::env::var("PATH").unwrap_or(String::new());
117+
path.push(':');
118+
path.push_str(&std::env::var("TARGET_RPATH_DIR").unwrap());
119+
cmd.env("PATH", &path);
120+
}
121+
112122
let output = cmd.output().unwrap();
113123
(cmd, output)
114124
}

0 commit comments

Comments
 (0)