mirror of
https://github.com/earendil-works/pi.git
synced 2026-06-18 15:54:04 +08:00
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:
@@ -26,8 +26,9 @@ function findBashOnPath(): string | null {
|
||||
* Get shell configuration based on platform.
|
||||
* Resolution order:
|
||||
* 1. User-specified shellPath in settings.json
|
||||
* 2. On Windows: Git Bash in known locations
|
||||
* 3. Fallback: bash on PATH (Windows) or sh (Unix)
|
||||
* 2. On Windows: Git Bash in known locations, then bash on PATH
|
||||
* 3. On Unix: /bin/bash
|
||||
* 4. Fallback: sh
|
||||
*/
|
||||
export function getShellConfig(): { shell: string; args: string[] } {
|
||||
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"] };
|
||||
return cachedShellConfig;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user