fix: conditionally enable shell on Windows for npx spawn calls
This commit is contained in:
@@ -36,7 +36,7 @@ function apiSavePlugin() {
|
||||
server.middlewares.use('/api/ai/sessions', (req: any, res: any) => {
|
||||
if (req.method !== 'GET') { res.writeHead(405); res.end(); return }
|
||||
try {
|
||||
const child = spawn('npx', ['opencode', 'session', 'list', '--format', 'json'], { timeout: 5000, stdio: ['ignore', 'pipe', 'pipe'] })
|
||||
const child = spawn('npx', ['opencode', 'session', 'list', '--format', 'json'], { timeout: 5000, stdio: ['ignore', 'pipe', 'pipe'], shell: process.platform === 'win32' })
|
||||
let stdout = ''
|
||||
let responded = false
|
||||
child.stdout.on('data', (d: Buffer) => stdout += d.toString())
|
||||
@@ -89,6 +89,7 @@ function apiSavePlugin() {
|
||||
env: { ...process.env, DEEPSEEK_API_KEY: apiKey || process.env.DEEPSEEK_API_KEY || '' },
|
||||
timeout: 60000,
|
||||
stdio: ['ignore', 'pipe', 'pipe'],
|
||||
shell: process.platform === 'win32',
|
||||
})
|
||||
|
||||
let stdout = ''
|
||||
|
||||
Reference in New Issue
Block a user