Skip to content

Commit 3033eee

Browse files
committed
Keep Windows tools std alone can launch
A Windows App Execution Alias (the Store python3.exe) is a reparse point the PATH lookup can't stat, though a bare spawn launches it. The Python probe shares this runner, so fall back to the bare name on Windows when the lookup finds nothing, rather than lose an interpreter that used to be found. Also satisfies clippy's redundant closure lint. Assisted-by: Claude Code:claude-opus-5-5
1 parent b29d415 commit 3033eee

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

‎crates/socket-patch-core/src/utils/process.rs‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ pub(crate) fn neutral_probe_dir() -> Option<PathBuf> {
178178
pub(crate) fn neutral_probe_dir_with(var: &impl Fn(&str) -> Option<OsString>) -> Option<PathBuf> {
179179
let home = ["HOME", "USERPROFILE"]
180180
.into_iter()
181-
.filter_map(|name| var(name))
181+
.filter_map(var)
182182
.map(PathBuf::from)
183183
.find(|path| path.is_absolute() && path.is_dir());
184184
home.or_else(|| {
@@ -197,7 +197,16 @@ fn run_resolved(bin: &str, args: &[&str], cwd: Option<&Path>) -> Option<String>
197197
let program = if Path::new(bin).components().count() > 1 {
198198
PathBuf::from(bin)
199199
} else {
200-
resolve_tool(bin)?
200+
match resolve_tool(bin) {
201+
Some(path) => path,
202+
// A Windows App Execution Alias (the Store `python3.exe` in
203+
// WindowsApps) is a reparse point the file probe can't stat,
204+
// but `std`'s own `.exe` search launches it; keep that path
205+
// rather than lose a tool the bare spawn always found. `std`
206+
// never searches the cwd on Windows.
207+
None if cfg!(windows) => PathBuf::from(bin),
208+
None => return None,
209+
}
201210
};
202211
let mut command = command_for(&program);
203212
command.args(args);

0 commit comments

Comments
 (0)