diff --git a/src/cli/doctor/checks/gh.test.ts b/src/cli/doctor/checks/gh.test.ts index 23593e5e..4d989dad 100644 --- a/src/cli/doctor/checks/gh.test.ts +++ b/src/cli/doctor/checks/gh.test.ts @@ -29,7 +29,7 @@ describe("gh cli check", () => { it("returns gh cli info structure", async () => { const spawnSpy = spyOn(Bun, "spawn").mockImplementation((cmd) => { - if (Array.isArray(cmd) && cmd[0] === "which" && cmd[1] === "gh") { + if (Array.isArray(cmd) && (cmd[0] === "which" || cmd[0] === "where") && cmd[1] === "gh") { return createProc({ stdout: "/usr/bin/gh\n" }) } diff --git a/src/cli/doctor/checks/gh.ts b/src/cli/doctor/checks/gh.ts index 06b2ca8e..af7ade8e 100644 --- a/src/cli/doctor/checks/gh.ts +++ b/src/cli/doctor/checks/gh.ts @@ -13,7 +13,8 @@ export interface GhCliInfo { async function checkBinaryExists(binary: string): Promise<{ exists: boolean; path: string | null }> { try { - const proc = Bun.spawn(["which", binary], { stdout: "pipe", stderr: "pipe" }) + const whichCmd = process.platform === "win32" ? "where" : "which" + const proc = Bun.spawn([whichCmd, binary], { stdout: "pipe", stderr: "pipe" }) const output = await new Response(proc.stdout).text() await proc.exited if (proc.exitCode === 0) {