fix(windows): resolve command execution and binary detection issues

This commit is contained in:
Burak Sormageç committed 2026-01-30 14:56:46 +00:00
1 parent da71eaebd2
commit 57d98eb1d7
3 files changed
+19 -12

No files matched your search

+9 -6
View File
@@ -77,13 +77,16 @@ 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", ""] : [""];
for (const part of parts) {
const candidate = path.join(part, bin);
try {
fs.accessSync(candidate, fs.constants.X_OK);
return true;
} catch {
// keep scanning
for (const ext of extensions) {
const candidate = path.join(part, bin + ext);
try {
fs.accessSync(candidate, fs.constants.X_OK);
return true;
} catch {
// keep scanning
}
}
}
return false;
+9 -6
View File
@@ -54,13 +54,16 @@ export function resolveRuntimePlatform(): 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", ""] : [""];
for (const part of parts) {
const candidate = path.join(part, bin);
try {
fs.accessSync(candidate, fs.constants.X_OK);
return true;
} catch {
// keep scanning
for (const ext of extensions) {
const candidate = path.join(part, bin + ext);
try {
fs.accessSync(candidate, fs.constants.X_OK);
return true;
} catch {
// keep scanning
}
}
}
return false;
+1
View File
@@ -85,6 +85,7 @@ export async function runCommandWithTimeout(
cwd,
env: resolvedEnv,
windowsVerbatimArguments,
shell: process.platform === "win32",
});
// Spawn with inherited stdin (TTY) so tools like `pi` stay interactive when needed.
return await new Promise((resolve, reject) => {