From 01cc4759237b0755b09bc9cc3e0a452a0e1af816 Mon Sep 17 00:00:00 2001 From: Ulises Jeremias Date: Wed, 3 Jun 2026 03:57:20 -0300 Subject: [PATCH] fix(opencode): fallback to sh for curl upgrade (#30499) Co-authored-by: Shoubhit Dash --- packages/opencode/src/installation/index.ts | 9 +++++++- .../test/installation/installation.test.ts | 21 +++++++++++++++++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/packages/opencode/src/installation/index.ts b/packages/opencode/src/installation/index.ts index 4367a26796..d2a2ffbe92 100644 --- a/packages/opencode/src/installation/index.ts +++ b/packages/opencode/src/installation/index.ts @@ -149,13 +149,20 @@ export const layer: Layer.Layer { testEffect( testLayer( () => new Response("install script with token=secret", { status: 200 }), - (cmd) => { - if (cmd === "bash") return { code: 1, stderr: "script output with token=secret" } + (cmd, args) => { + if (cmd === "bash" && args[0] === "--version") return "GNU bash" + if (cmd === "bash" || cmd === "sh") return { code: 1, stderr: "script output with token=secret" } return "" }, ), @@ -209,5 +210,21 @@ describe("installation", () => { expect(error.stderr).not.toContain("script output") }), ) + + testEffect( + testLayer( + () => new Response("install script", { status: 200 }), + (cmd, args) => { + if (cmd === "bash" && args[0] === "--version") return { code: 1, stderr: "missing" } + if (cmd === "bash") return { code: 1, stderr: "should not execute installer with bash" } + if (cmd === "sh") return "ok" + return "" + }, + ), + ).effect("falls back to sh when bash is unavailable during curl upgrade", () => + Effect.gen(function* () { + yield* Installation.use.upgrade("curl", "9.9.9") + }), + ) }) })