fix(server): stop detecting Windows PowerShell shims

This commit is contained in:
Mohamed Boudra
2026-04-16 18:36:06 +07:00
parent 84db0cecd7
commit 4d0fe57a7a
4 changed files with 23 additions and 75 deletions
+13 -1
View File
@@ -138,7 +138,7 @@ describe("executableExists", () => {
expect(executableExists("/usr/local/bin/codex", exists)).toBe("/usr/local/bin/codex");
});
test("on Windows, falls back to .exe, .cmd, then .ps1 for extensionless paths", () => {
test("on Windows, falls back to .exe, then .cmd for extensionless paths", () => {
const originalPlatform = process.platform;
Object.defineProperty(process, "platform", { value: "win32", writable: true });
try {
@@ -150,6 +150,18 @@ describe("executableExists", () => {
}
});
test("on Windows, ignores PowerShell scripts for extensionless paths", () => {
const originalPlatform = process.platform;
Object.defineProperty(process, "platform", { value: "win32", writable: true });
try {
const exists = (candidate: string) => candidate === "C:\\tools\\codex.ps1";
expect(executableExists("C:\\tools\\codex", exists)).toBeNull();
} finally {
Object.defineProperty(process, "platform", { value: originalPlatform, writable: true });
}
});
test("returns null when no matching path exists", () => {
expect(executableExists("/missing/codex", () => false)).toBeNull();
});