claude-code - 💡(How to fix) Fix [Windows] Hook subprocess spawning creates visible console window flashes on every tool call [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#54519Fetched 2026-04-30 06:43:24
View on GitHub
Comments
1
Participants
2
Timeline
7
Reactions
0
Author
Timeline (top)
labeled ×4cross-referenced ×2commented ×1

Root Cause

Problem

On Windows, every hook invocation (PreToolUse, PostToolUse, SessionStart, etc.) causes a console window (PowerShell or cmd) to briefly flash on screen. This happens because Claude Code's hook subprocess spawner does not set windowsHide: true (or equivalent CREATE_NO_WINDOW flag) when spawning hook processes on Windows.

Fix Action

Workaround

Wrapping hook commands with powershell.exe -WindowStyle Hidden -NonInteractive -NoProfile -ExecutionPolicy Bypass -File <wrapper.ps1> partially mitigates the issue but adds ~200ms latency per hook call, gets overwritten on plugin upgrade, and is fragile. The correct fix is in Claude Code's hook process spawner.

Code Example

spawn(cmd, args, { windowsHide: true, ...rest })
RAW_BUFFERClick to expand / collapse

Environment

  • Platform: Windows 11 Enterprise
  • Claude Code: VS Code extension
  • Node.js: v24.14.0

Problem

On Windows, every hook invocation (PreToolUse, PostToolUse, SessionStart, etc.) causes a console window (PowerShell or cmd) to briefly flash on screen. This happens because Claude Code's hook subprocess spawner does not set windowsHide: true (or equivalent CREATE_NO_WINDOW flag) when spawning hook processes on Windows.

Hook commands like node "path/to/hook.mjs" are spawned without suppressing the console window, causing a visible flash for every tool call. With plugins like context-mode that register hooks for Bash, Read, Grep, WebFetch, Agent, and multiple MCP tools, this results in dozens of console flashes per conversation turn — extremely distracting during normal use.

Expected Behavior

Hook processes run silently in the background with no visible console windows.

Steps to Reproduce

  1. Install Claude Code VS Code extension on Windows
  2. Install any plugin that registers a Node.js-based hook (e.g. context-mode)
  3. Trigger a tool call that matches the hook (e.g. a Bash or Read)
  4. Observe console window flash

Proposed Fix

The subprocess spawner for hooks should use:

spawn(cmd, args, { windowsHide: true, ...rest })

This maps to CREATE_NO_WINDOW on Windows and eliminates the console flash without affecting hook stdin/stdout piping.

Workaround

Wrapping hook commands with powershell.exe -WindowStyle Hidden -NonInteractive -NoProfile -ExecutionPolicy Bypass -File <wrapper.ps1> partially mitigates the issue but adds ~200ms latency per hook call, gets overwritten on plugin upgrade, and is fragile. The correct fix is in Claude Code's hook process spawner.

extent analysis

TL;DR

The proposed fix involves modifying the subprocess spawner for hooks to use windowsHide: true when spawning hook processes on Windows.

Guidance

  • Verify the issue by checking if the console window flash occurs when triggering a tool call that matches a registered hook.
  • To mitigate the issue, consider using the proposed fix in the subprocess spawner: spawn(cmd, args, { windowsHide: true, ...rest }).
  • Test the fix by installing the modified Claude Code VS Code extension and triggering a tool call to ensure the console window no longer flashes.
  • If the fix is not feasible, the workaround using powershell.exe can be used, but be aware of the added latency and potential fragility.

Example

// Example of modified subprocess spawner
const spawn = require('child_process').spawn;
const cmd = 'node';
const args = ['path/to/hook.mjs'];
const options = { windowsHide: true };
spawn(cmd, args, options);

Notes

The proposed fix assumes that the windowsHide option is supported by the subprocess spawner used in Claude Code. If this option is not supported, an alternative solution may be needed.

Recommendation

Apply the proposed fix by modifying the subprocess spawner to use windowsHide: true, as this is the most straightforward and efficient solution to eliminate the console window flash.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [Windows] Hook subprocess spawning creates visible console window flashes on every tool call [1 comments, 2 participants]