fix: tighten executable path coverage

This commit is contained in:
Peter Steinberger
2026-03-13 22:07:14 +00:00
parent 0826feb94d
commit fac754041c
2 changed files with 26 additions and 1 deletions

View File

@@ -60,7 +60,9 @@ export function resolveExecutablePath(
rawExecutable: string,
options?: { cwd?: string; env?: NodeJS.ProcessEnv },
): string | undefined {
const expanded = rawExecutable.startsWith("~") ? expandHomePrefix(rawExecutable) : rawExecutable;
const expanded = rawExecutable.startsWith("~")
? expandHomePrefix(rawExecutable, { env: options?.env })
: rawExecutable;
if (expanded.includes("/") || expanded.includes("\\")) {
if (path.isAbsolute(expanded)) {
return isExecutableFile(expanded) ? expanded : undefined;