Просмотр исходного кода

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

Matthew Reishus 1 год назад
Родитель
Сommit
20ba82f842
1 измененных файлов с 11 добавлено и 1 удалено
  1. 11 1
      theme-utils.mjs

+ 11 - 1
theme-utils.mjs

@@ -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,
 			});