-
Notifications
You must be signed in to change notification settings - Fork 35
Closed
Labels
bugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bug
Description
Bug Description
On Windows, the pyenv locator fails to detect pyenv-win from PATH because it looks for pyenv.exe, but pyenv-win provides pyenv.bat instead.
Location
crates/pet-pyenv/src/environment_locations.rs in get_binary_from_known_paths():
pub fn get_binary_from_known_paths(env_vars: &EnvVariables) -> Option<PathBuf> {
for known_path in &env_vars.known_global_search_locations {
let exe = if cfg!(windows) {
known_path.join("pyenv.exe") // <-- BUG: should be pyenv.bat
} else {
known_path.join("pyenv")
};
if exe.is_file() {
return Some(norm_case(exe));
}
}
None
}pyenv-win Actual Files
According to the pyenv-win repository, the bin/ folder contains:
pyenv.bat- Main Windows batch filepyenv.ps1- PowerShell scriptpyenv- Shell script for cygwin/git-bash
There is no pyenv.exe file.
Expected Behavior
The code should look for pyenv.bat on Windows when searching PATH directories.
Suggested Fix
pub fn get_binary_from_known_paths(env_vars: &EnvVariables) -> Option<PathBuf> {
for known_path in &env_vars.known_global_search_locations {
if cfg!(windows) {
// pyenv-win provides pyenv.bat, not pyenv.exe
let exe = known_path.join("pyenv.bat");
if exe.is_file() {
return Some(norm_case(exe));
}
} else {
let exe = known_path.join("pyenv");
if exe.is_file() {
return Some(norm_case(exe));
}
}
}
None
}Related Issue
Metadata
Metadata
Assignees
Labels
bugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bug