Skip to content

Commit 7f7969e

Browse files
authored
Auto merge of #35117 - aravind-pg:path, r=alexcrichton
On Windows, ensure PATH does not contain invalid character `"` Fixes #34959. r? @alexcrichton
2 parents ffcbd2d + 4ffbb5d commit 7f7969e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/bootstrap/sanity.rs

+9
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@ use Build;
3131
pub fn check(build: &mut Build) {
3232
let mut checked = HashSet::new();
3333
let path = env::var_os("PATH").unwrap_or(OsString::new());
34+
// On Windows, quotes are invalid characters for filename paths, and if
35+
// one is present as part of the PATH then that can lead to the system
36+
// being unable to identify the files properly. See
37+
// https://github.com/rust-lang/rust/issues/34959 for more details.
38+
if cfg!(windows) {
39+
if path.to_string_lossy().contains("\"") {
40+
panic!("PATH contains invalid character '\"'");
41+
}
42+
}
3443
let mut need_cmd = |cmd: &OsStr| {
3544
if !checked.insert(cmd.to_owned()) {
3645
return

0 commit comments

Comments
 (0)