Windows: console windows flash when extension spawns child processes
Description
On Windows 11, the Claude Code VS Code extension spawns child processes (gh.exe, bash.exe, python.exe, etc.) without setting windowsHide: true in the Node.js child_process.spawn() options. This causes visible console windows to flash on screen, stealing keyboard focus and interrupting the user's typing.
Environment
- Windows 11 Home (10.0.26200)
- VS Code (latest)
- Claude Code extension (latest)
Steps to Reproduce
- Open VS Code on Windows with Claude Code extension active
- Start a Claude Code session
- Observe console windows flashing periodically (especially for
gh.exeandbash.execalls)
The windows appear briefly and steal focus, interrupting whatever the user is typing. Some processes (like MCP servers) create persistent console windows that remain open.
Expected Behavior
Child processes should be spawned with windowsHide: true in the child_process.spawn() / child_process.exec() options on Windows. This prevents console window creation without affecting functionality, as stdio is piped anyway.
Workaround
We've worked around this by:
- Creating a wrapper
gh.exethat proxies calls to the real binary withCreateNoWindow = true - Adding
creationflags=subprocess.CREATE_NO_WINDOW(0x08000000) to Python subprocess calls in hooks
But these are band-aids — the fix should be in the extension's process spawning code.
Fix
In every child_process.spawn() / child_process.exec() / child_process.execFile() call, add:
const options = {
// ... existing options
windowsHide: true, // Prevents console window flash on Windows
};
This is a no-op on non-Windows platforms.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗