Skip to content

Commit 5360ded

Browse files
committed
fix an issue with path probing on Windows
The old logic would incorrectly look for "python2.exe" when searching for "python2.7.exe".
1 parent 7f19f16 commit 5360ded

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/bootstrap/sanity.rs

+9-7
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,17 @@ impl Finder {
3434

3535
fn maybe_have<S: AsRef<OsStr>>(&mut self, cmd: S) -> Option<PathBuf> {
3636
let cmd: OsString = cmd.as_ref().into();
37-
let path = self.path.clone();
37+
let path = &self.path;
3838
self.cache.entry(cmd.clone()).or_insert_with(|| {
39-
for path in env::split_paths(&path) {
39+
for path in env::split_paths(path) {
4040
let target = path.join(&cmd);
41-
let mut cmd_alt = cmd.clone();
42-
cmd_alt.push(".exe");
43-
if target.is_file() || // some/path/git
44-
target.with_extension("exe").exists() || // some/path/git.exe
45-
target.join(&cmd_alt).exists() { // some/path/git/git.exe
41+
let mut cmd_exe = cmd.clone();
42+
cmd_exe.push(".exe");
43+
44+
if target.is_file() // some/path/git
45+
|| path.join(&cmd_exe).exists() // some/path/git.exe
46+
|| target.join(&cmd_exe).exists() // some/path/git/git.exe
47+
{
4648
return Some(target);
4749
}
4850
}

0 commit comments

Comments
 (0)