fix: 工作空间进程根据平台选择 shell(Windows 用 cmd.exe,其他用 bash)
This commit is contained in:
@@ -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']
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user