[Windows] Statusline and hook commands spawn bash.exe without CREATE_NO_WINDOW, causing visible console flash every ~10 seconds

Resolved 💬 3 comments Opened Apr 22, 2026 by davidb-69 Closed May 28, 2026

Summary

On Windows, Claude Code runs statusline commands and hook commands (e.g. Stop hook) by spawning bash.exe as an intermediary shell. That bash process is created without the CREATE_NO_WINDOW flag, so a console window (managed by conhost.exe) briefly flashes on screen every time the status bar updates — typically every 10 seconds.

Environment

  • OS: Windows 11 Home 10.0.26200
  • Claude Code: latest (autoUpdatesChannel: latest)
  • Shell: Git Bash (bash.exe from C:\Program Files\Gitin\)
  • Settings: statusLine type command, Stop hook type command

Steps to reproduce

Configure a statusline command in .claude/settings.json:

{
  "statusLine": {
    "type": "command",
    "command": "C:/path/to/pythonw.exe C:/path/to/statusline.py"
  }
}

Every time Claude Code updates the status bar, a brief dark console window flashes on screen. The flash lasts for the entire execution time of the command (~200ms for a typical Python script; even bash -c "cat file.txt" produces a ~76ms flash because bash itself creates and destroys a console window).

Root cause (confirmed via WMI process monitoring)

Claude Code spawns the following chain on every statusline tick:

claude.exe
  └── bash.exe  (Windows creates conhost.exe for this — the flash)
        └── pythonw.exe statusline.py

WMI __InstanceCreationEvent monitoring captures this on every tick:

SPAWN  conhost.exe  PID=12456
       parent=<statusline runner>
       cmd: \??\C:\WINDOWS\system32\conhost.exe 0x4

SPAWN  bash.exe  PID=21940
       parent=<statusline runner>
       cmd: C:\Program Files\Gitinash.exe -c <statusline command>

If bash.exe were spawned with CREATE_NO_WINDOW (Win32 flag 0x08000000), Windows would create a hidden console host and no window would flash. The same issue occurs with hook commands (Stop hook, etc.).

What I tried

  • Switching from python.exe to pythonw.exe (GUI subsystem) — flash persists because bash.exe itself creates the console
  • Minimising script execution time (reducing from ~400ms to ~200ms) — reduces flash duration but does not eliminate it
  • Compiled a .NET 6 binary to replace Python — same result (~200ms), since the bash overhead is the bottleneck
  • Minimum achievable with current architecture: bash -c "cat file" = ~76ms, still visible

Expected behaviour

Console commands invoked for statusline / hooks should not produce any visible window. This is standard practice for background processes on Windows.

Proposed fix

In the Node.js code that spawns statusline/hook subprocesses, add windowsHide: true to the spawn options:

// child_process.spawn / exec / execFile
const child = spawn(shell, ['-c', command], {
  windowsHide: true,   // sets CREATE_NO_WINDOW on Windows — one line fix
  // ... other options
});

windowsHide: true is a built-in Node.js option that internally sets CREATE_NO_WINDOW when calling CreateProcess on Windows. This single flag change would eliminate all console flashing for statusline and hook commands.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗