theme-utils: Fix for fish shell (#7398)

This commit is contained in:
Matthew Reishus 2023-10-31 15:03:39 -05:00 committed by GitHub
parent 042cf39083
commit 20ba82f842
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1099,7 +1099,17 @@ export async function executeCommand(command, logResponse) {
detached: true,
})
} else {
child = spawn(process.env.SHELL, ['-c', command], {
/*
* Determines the shell to execute the command.
* - Prioritizes using the user's default shell unless it's fish, a known problematic shell.
* - In this case, falls back to `/bin/bash` for better syntax compatibility.
*/
let shellPath = process.env.SHELL || '/bin/bash';
if (shellPath.includes('fish') && fs.existsSync('/bin/bash')) {
shellPath = '/bin/bash';
}
child = spawn(shellPath, ['-c', command], {
stdio: [process.stdin, 'pipe', 'pipe'],
detached: true,
});