diff --git a/crates/pet-python-utils/src/executable.rs b/crates/pet-python-utils/src/executable.rs index 6e8384a4..124a1fab 100644 --- a/crates/pet-python-utils/src/executable.rs +++ b/crates/pet-python-utils/src/executable.rs @@ -12,7 +12,7 @@ use std::{ lazy_static! { static ref WINDOWS_EXE: Regex = - Regex::new(r"python(\d+\.?)*.exe").expect("error parsing Windows executable regex"); + Regex::new(r"python(\d+\.?)*\.exe$").expect("error parsing Windows executable regex"); static ref UNIX_EXE: Regex = Regex::new(r"python(\d+\.?)*$").expect("error parsing Unix executable regex"); } @@ -342,6 +342,18 @@ mod tests { assert!(!is_python_executable_name( PathBuf::from("pythonw3.exe").as_path() )); + #[cfg(windows)] + assert!(!is_python_executable_name( + PathBuf::from("python.exe.__target__").as_path() + )); + #[cfg(windows)] + assert!(!is_python_executable_name( + PathBuf::from("python3.exe.__target__").as_path() + )); + #[cfg(windows)] + assert!(!is_python_executable_name( + PathBuf::from("python3.12.exe.__target__").as_path() + )); } #[test]