From 8ddedc3fc571080d5c33fd9abfab17c1dd7a0100 Mon Sep 17 00:00:00 2001 From: ysqander Date: Tue, 20 Jan 2026 17:42:02 +0800 Subject: [PATCH] exec: prefer bash when fish is default shell --- src/agents/shell-utils.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/agents/shell-utils.ts b/src/agents/shell-utils.ts index 27ac5bf21..ce3d4f0c3 100644 --- a/src/agents/shell-utils.ts +++ b/src/agents/shell-utils.ts @@ -1,4 +1,5 @@ import { spawn } from "node:child_process"; +import path from "node:path"; export function getShellConfig(): { shell: string; args: string[] } { if (process.platform === "win32") { @@ -13,7 +14,13 @@ export function getShellConfig(): { shell: string; args: string[] } { }; } - const shell = process.env.SHELL?.trim() || "sh"; + const envShell = process.env.SHELL?.trim(); + const shellName = envShell ? path.basename(envShell) : ""; + // Fish rejects common bashisms used by tools, so prefer bash when detected. + if (shellName === "fish") { + return { shell: "/bin/bash", args: ["-c"] }; + } + const shell = envShell || "sh"; return { shell, args: ["-c"] }; }