From 947a26f4dfdd5d37f81f8f8b1e58a218f57eeedd Mon Sep 17 00:00:00 2001 From: LukeParkerDev <10430890+Hona@users.noreply.github.com> Date: Thu, 2 Apr 2026 12:49:43 +1000 Subject: [PATCH] refactor: clean up shell file fetching logic --- packages/opencode/src/shell/shell.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/packages/opencode/src/shell/shell.ts b/packages/opencode/src/shell/shell.ts index f94409f399..992bab2400 100644 --- a/packages/opencode/src/shell/shell.ts +++ b/packages/opencode/src/shell/shell.ts @@ -124,13 +124,12 @@ export namespace Shell { return [gitbash(), Bun.which("pwsh"), Bun.which("powershell"), process.env.COMSPEC || "cmd.exe"].filter( Boolean, ) as string[] - } else { - try { - const text = await Bun.file("/etc/shells").text() - return text.split("\n").filter((line) => line.trim() && !line.startsWith("#")) - } catch { - return ["/bin/bash", "/bin/zsh", "/bin/sh"] - } } + const file = Bun.file("/etc/shells") + if (await file.exists()) { + const text = await file.text() + return text.split("\n").filter((line) => line.trim() && !line.startsWith("#")) + } + return ["/bin/bash", "/bin/zsh", "/bin/sh"] } }