fix(windows): git path resolution for modified files across Git Bash, MSYS2, and Cygwin (#16422)

This commit is contained in:
Luke Parker
2026-03-07 15:42:14 +10:00
committed by GitHub
parent c42c5a0cc6
commit 8a95be492d
13 changed files with 286 additions and 102 deletions

View File

@@ -3,8 +3,8 @@ import whichPkg from "which"
export function which(cmd: string, env?: NodeJS.ProcessEnv) {
const result = whichPkg.sync(cmd, {
nothrow: true,
path: env?.PATH,
pathExt: env?.PATHEXT,
path: env?.PATH ?? env?.Path ?? process.env.PATH ?? process.env.Path,
pathExt: env?.PATHEXT ?? env?.PathExt ?? process.env.PATHEXT ?? process.env.PathExt,
})
return typeof result === "string" ? result : null
}