Merge pull request #328 from dnouri/fix/use-bash-on-unix

fix: Use bash instead of sh on Unix systems
This commit is contained in:
Mario Zechner 2025-12-27 01:03:58 +01:00 committed by GitHub
commit 04fa79ebe0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -26,8 +26,9 @@ function findBashOnPath(): string | null {
* Get shell configuration based on platform. * Get shell configuration based on platform.
* Resolution order: * Resolution order:
* 1. User-specified shellPath in settings.json * 1. User-specified shellPath in settings.json
* 2. On Windows: Git Bash in known locations * 2. On Windows: Git Bash in known locations, then bash on PATH
* 3. Fallback: bash on PATH (Windows) or sh (Unix) * 3. On Unix: /bin/bash
* 4. Fallback: sh
*/ */
export function getShellConfig(): { shell: string; args: string[] } { export function getShellConfig(): { shell: string; args: string[] } {
if (cachedShellConfig) { if (cachedShellConfig) {
@ -83,6 +84,12 @@ export function getShellConfig(): { shell: string; args: string[] } {
); );
} }
// Unix: prefer bash over sh
if (existsSync("/bin/bash")) {
cachedShellConfig = { shell: "/bin/bash", args: ["-c"] };
return cachedShellConfig;
}
cachedShellConfig = { shell: "sh", args: ["-c"] }; cachedShellConfig = { shell: "sh", args: ["-c"] };
return cachedShellConfig; return cachedShellConfig;
} }