This commit is contained in:
Thanh Nguyen 2026-01-30 15:57:57 +00:00 committed by GitHub
commit 700dadc1da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 26 additions and 2 deletions

View File

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

View File

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

View File

@ -7,7 +7,9 @@ export async function ensureBinary(
runtime: RuntimeEnv = defaultRuntime,
): Promise<void> {
// 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);
});