Merge pull request #1603 from code-yeongyu/fix/1269-windows-which-detection

fix: use platform-aware binary detection on Windows (#1269)
This commit is contained in:
YeonGyu-Kim
2026-02-07 18:51:28 +09:00
committed by GitHub
2 changed files with 3 additions and 2 deletions

View File

@@ -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" })
}

View File

@@ -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) {