fix: 工作空间进程根据平台选择 shell(Windows 用 cmd.exe,其他用 bash)

This commit is contained in:
thzxx
2026-04-07 20:15:50 +08:00
parent 5d0fff7f01
commit e7efd87ba6
+5 -2
View File
@@ -86,9 +86,12 @@ export function startProcess(
} }
try { try {
const proc = spawn('bash', ['-c', command], { const isWin = process.platform === 'win32';
const shell = isWin ? 'cmd.exe' : 'bash';
const shellArgs = isWin ? ['/c', command] : ['-c', command];
const proc = spawn(shell, shellArgs, {
cwd: workDir, cwd: workDir,
env: { ...process.env, TERM: 'xterm-256color' }, env: { ...process.env, ...(isWin ? {} : { TERM: 'xterm-256color' }) },
stdio: ['pipe', 'pipe', 'pipe'] stdio: ['pipe', 'pipe', 'pipe']
}); });