Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Burak Sormageç
2026-02-11 23:28:41 -05:00
committed by Peter Steinberger
parent 23b1b51568
commit ff0ce32840

View File

@@ -99,7 +99,12 @@ export function isBundledSkillAllowed(entry: SkillEntry, allowlist?: string[]):
export function hasBinary(bin: string): boolean {
const pathEnv = process.env.PATH ?? "";
const parts = pathEnv.split(path.delimiter).filter(Boolean);
const extensions = process.platform === "win32" ? [".exe", ".cmd", ".bat", ""] : [""];
const winPathExt = process.env.PATHEXT;
const winExtensions =
winPathExt !== undefined
? winPathExt.split(";").filter(Boolean)
: [".EXE", ".CMD", ".BAT", ".COM"];
const extensions = process.platform === "win32" ? ["", ...winExtensions] : [""];
for (const part of parts) {
for (const ext of extensions) {
const candidate = path.join(part, bin + ext);