From 90f58333e94c94242e5bd282a1a10536b1f94b83 Mon Sep 17 00:00:00 2001 From: Sebastian <19554889+sebslight@users.noreply.github.com> Date: Tue, 10 Feb 2026 18:04:37 -0500 Subject: [PATCH] test(docker): make bash 3.2 compatibility check portable --- src/docker-setup.test.ts | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/docker-setup.test.ts b/src/docker-setup.test.ts index 334221a580a..3201c9a8229 100644 --- a/src/docker-setup.test.ts +++ b/src/docker-setup.test.ts @@ -73,6 +73,17 @@ function createEnv( }; } +function resolveBashForCompatCheck(): string | null { + for (const candidate of ["/bin/bash", "bash"]) { + const probe = spawnSync(candidate, ["-c", "exit 0"], { encoding: "utf8" }); + if (!probe.error && probe.status === 0) { + return candidate; + } + } + + return null; +} + describe("docker-setup.sh", () => { it("handles unset optional env vars under strict mode", async () => { const sandbox = await createDockerSetupSandbox(); @@ -121,11 +132,15 @@ describe("docker-setup.sh", () => { const script = await readFile(join(repoRoot, "docker-setup.sh"), "utf8"); expect(script).not.toMatch(/^\s*declare -A\b/m); - const systemBash = "/bin/bash"; + const systemBash = resolveBashForCompatCheck(); + if (!systemBash) { + return; + } + const assocCheck = spawnSync(systemBash, ["-c", "declare -A _t=()"], { encoding: "utf8", }); - if (assocCheck.status === 0) { + if (assocCheck.status === null || assocCheck.status === 0) { return; }