Merge pull request #1297 from ysqander/fix/fish-shell-bash

exec: prefer bash when fish is default shell
This commit is contained in:
Peter Steinberger 2026-01-20 11:13:35 +00:00 committed by GitHub
commit 9ec1fb4a80
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,6 +1,7 @@
import fs from "node:fs";
import path from "node:path";
import { spawn } from "node:child_process";
import path from "node:path";
function resolvePowerShellPath(): string {
const systemRoot = process.env.SystemRoot || process.env.WINDIR;
@ -30,7 +31,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"] };
}