Auto merge of #35117 - aravind-pg:path, r=alexcrichton

On Windows, ensure PATH does not contain invalid character `"`

Fixes #34959.

r? @alexcrichton
This commit is contained in:
bors 2016-07-30 10:11:33 -07:00 committed by GitHub
commit 7f7969ef44

View File

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