fix: resolve Windows exec paths with extensions
This commit is contained in:
@@ -360,11 +360,14 @@ function resolveExecutablePath(rawExecutable: string, cwd?: string, env?: NodeJS
|
|||||||
}
|
}
|
||||||
const envPath = env?.PATH ?? process.env.PATH ?? "";
|
const envPath = env?.PATH ?? process.env.PATH ?? "";
|
||||||
const entries = envPath.split(path.delimiter).filter(Boolean);
|
const entries = envPath.split(path.delimiter).filter(Boolean);
|
||||||
|
const hasExtension = process.platform === "win32" && path.extname(expanded).length > 0;
|
||||||
const extensions =
|
const extensions =
|
||||||
process.platform === "win32"
|
process.platform === "win32"
|
||||||
? (env?.PATHEXT ?? process.env.PATHEXT ?? ".EXE;.CMD;.BAT;.COM")
|
? hasExtension
|
||||||
.split(";")
|
? [""]
|
||||||
.map((ext) => ext.toLowerCase())
|
: (env?.PATHEXT ?? process.env.PATHEXT ?? ".EXE;.CMD;.BAT;.COM")
|
||||||
|
.split(";")
|
||||||
|
.map((ext) => ext.toLowerCase())
|
||||||
: [""];
|
: [""];
|
||||||
for (const entry of entries) {
|
for (const entry of entries) {
|
||||||
for (const ext of extensions) {
|
for (const ext of extensions) {
|
||||||
|
|||||||
Reference in New Issue
Block a user