diff --git a/src/services/SummaryService.ts b/src/services/SummaryService.ts index ba77bdc..fc74b32 100644 --- a/src/services/SummaryService.ts +++ b/src/services/SummaryService.ts @@ -188,7 +188,6 @@ Return ONLY a JSON array in the same order: [{"title":"...","description":"...", const child = spawn(backend.path, args, { cwd: os.tmpdir(), env: CHILD_ENV, - shell: process.platform === 'win32', // required to execute .cmd/.bat files on Windows signal: ac.signal, }); @@ -266,8 +265,7 @@ Return ONLY a JSON array in the same order: [{"title":"...","description":"...", const binPath = stdout.trim().split('\n')[0].trim(); const child = spawn(binPath, ['--version'], { timeout: CLI_CHECK_TIMEOUT_MS, - env: CHILD_ENV, - shell: isWindows // required to execute .cmd/.bat files on Windows + env: CHILD_ENV }); child.on('error', () => resolve(undefined)); child.on('close', (code) => resolve(code === 0 ? binPath : undefined)); diff --git a/standalone/StandaloneMessageHandler.ts b/standalone/StandaloneMessageHandler.ts index 80bcf69..82692fd 100644 --- a/standalone/StandaloneMessageHandler.ts +++ b/standalone/StandaloneMessageHandler.ts @@ -365,7 +365,7 @@ export class StandaloneMessageHandler { /** Open a workspace folder in an editor (VSCode, Cursor, etc.). */ private openInEditor(cmd: string, cwd: string) { - execFile(cmd, [cwd], { shell: process.platform === 'win32' }, (err) => { + execFile(cmd, [cwd], (err) => { if (err) { console.error(`Claudine: Failed to open ${cmd}`, err); this._send({ type: 'error', message: `Failed to open ${cmd}: ${err.message}` }); @@ -376,11 +376,23 @@ export class StandaloneMessageHandler { /** Resume a Claude Code conversation in a terminal emulator. */ private openInTerminal(cwd: string, sessionId: string) { const platform = process.platform; - // Strip Node.js debugger variables that interfere with child processes (mainly relevant to - // VS Code debug sessions). NODE_OPTIONS may carry debugger bootstrap flags (--require) that - // claude's embedded Node can't resolve. - const env = { ...process.env }; - delete env['NODE_OPTIONS']; + // Use a minimal env to avoid leaking secrets and stripping Node.js debugger + // variables (e.g. NODE_OPTIONS) that interfere with child processes. + const env: NodeJS.ProcessEnv = { + PATH: process.env.PATH, + HOME: process.env.HOME, + LANG: process.env.LANG, + TERM: process.env.TERM, + // Windows: needed for terminal emulators to locate config dirs and resolve .cmd files + ...(platform === 'win32' && { + APPDATA: process.env.APPDATA, + USERPROFILE: process.env.USERPROFILE, + PATHEXT: process.env.PATHEXT, + SystemRoot: process.env.SystemRoot, + TEMP: process.env.TEMP, + TMP: process.env.TMP, + }), + }; const resumeCmd = `claude --resume ${sessionId}`;