From 23af14a32dacc2e984f8609aea5f79bf7bfaf38a Mon Sep 17 00:00:00 2001 From: ThanhNguyxn Date: Mon, 26 Jan 2026 19:21:57 +0700 Subject: [PATCH 1/3] fix(infra): use `where` on Windows for binary detection Fixes #2172 --- src/infra/binaries.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/infra/binaries.ts b/src/infra/binaries.ts index 492cf5a9c..3e82ee940 100644 --- a/src/infra/binaries.ts +++ b/src/infra/binaries.ts @@ -7,7 +7,9 @@ export async function ensureBinary( runtime: RuntimeEnv = defaultRuntime, ): Promise { // Abort early if a required CLI tool is missing. - await exec("which", [name]).catch(() => { + // Use `where` on Windows, `which` elsewhere. + const cmd = process.platform === "win32" ? "where" : "which"; + await exec(cmd, [name]).catch(() => { runtime.error(`Missing required binary: ${name}. Please install it.`); runtime.exit(1); }); From 9db43df1e28ae21486715188a221d0eeee0364a7 Mon Sep 17 00:00:00 2001 From: ThanhNguyxn Date: Tue, 27 Jan 2026 12:15:16 +0700 Subject: [PATCH 2/3] test(infra): update binaries test for Windows/Unix platform detection --- src/infra/binaries.test.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/infra/binaries.test.ts b/src/infra/binaries.test.ts index 50b48d372..6c2faf96d 100644 --- a/src/infra/binaries.test.ts +++ b/src/infra/binaries.test.ts @@ -4,6 +4,8 @@ import type { runExec } from "../process/exec.js"; import type { RuntimeEnv } from "../runtime.js"; import { ensureBinary } from "./binaries.js"; +const expectedCmd = process.platform === "win32" ? "where" : "which"; + describe("ensureBinary", () => { it("passes through when binary exists", async () => { const exec: typeof runExec = vi.fn().mockResolvedValue({ @@ -16,7 +18,7 @@ describe("ensureBinary", () => { exit: vi.fn(), }; await ensureBinary("node", exec, runtime); - expect(exec).toHaveBeenCalledWith("which", ["node"]); + expect(exec).toHaveBeenCalledWith(expectedCmd, ["node"]); }); it("logs and exits when missing", async () => { From 732983ee72320208291265f30132a103708377dc Mon Sep 17 00:00:00 2001 From: ThanhNguyxn Date: Fri, 30 Jan 2026 22:56:50 +0700 Subject: [PATCH 3/3] ci: skip submodule update when no .gitmodules --- .github/workflows/ci.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 885d87fcb..a2abe26ca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,10 @@ jobs: - name: Checkout submodules (retry) run: | set -euo pipefail + if [ ! -f .gitmodules ]; then + echo "No .gitmodules found; skipping submodule update." + exit 0 + fi git submodule sync --recursive for attempt in 1 2 3 4 5; do if git -c protocol.version=2 submodule update --init --force --depth=1 --recursive; then @@ -101,6 +105,10 @@ jobs: - name: Checkout submodules (retry) run: | set -euo pipefail + if [ ! -f .gitmodules ]; then + echo "No .gitmodules found; skipping submodule update." + exit 0 + fi git submodule sync --recursive for attempt in 1 2 3 4 5; do if git -c protocol.version=2 submodule update --init --force --depth=1 --recursive; then @@ -217,6 +225,10 @@ jobs: - name: Checkout submodules (retry) run: | set -euo pipefail + if [ ! -f .gitmodules ]; then + echo "No .gitmodules found; skipping submodule update." + exit 0 + fi git submodule sync --recursive for attempt in 1 2 3 4 5; do if git -c protocol.version=2 submodule update --init --force --depth=1 --recursive; then @@ -293,6 +305,10 @@ jobs: - name: Checkout submodules (retry) run: | set -euo pipefail + if [ ! -f .gitmodules ]; then + echo "No .gitmodules found; skipping submodule update." + exit 0 + fi git submodule sync --recursive for attempt in 1 2 3 4 5; do if git -c protocol.version=2 submodule update --init --force --depth=1 --recursive; then @@ -389,6 +405,10 @@ jobs: - name: Checkout submodules (retry) run: | set -euo pipefail + if [ ! -f .gitmodules ]; then + echo "No .gitmodules found; skipping submodule update." + exit 0 + fi git submodule sync --recursive for attempt in 1 2 3 4 5; do if git -c protocol.version=2 submodule update --init --force --depth=1 --recursive; then