claude-code - 💡(How to fix) Fix [BUG] Windows: hooks using stdin freeze sessions indefinitely, cmd.exe windows pop up [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#46177Fetched 2026-04-11 06:27:06
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Author
Timeline (top)
labeled ×3commented ×1

Error Message

Error Messages/Logs

Root Cause

Additional issue: Every hook invocation opens a visible cmd.exe window on Windows because windowsHide: true is not passed when spawning hook processes. This causes constant black CMD windows popping up during work.

RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

On Windows, any hook (PreToolUse, UserPromptSubmit, Stop) that runs a node script reading from stdin freezes the entire Claude Code session permanently.

What happens:

  1. Hook spawns node.exe which reads stdin via process.stdin.on('end', ...)
  2. On Windows, stdin is never properly closed to the child process
  3. The node process hangs forever waiting for EOF
  4. Claude Code waits for the hook to complete → entire session freezes
  5. Session shows "Stewing..." / "Wibbling..." / "Crafting..." but never progresses, consumes no tokens
  6. Claude Desktop re-animates killed sessions via --resume, creating zombie sessions

Additional issue: Every hook invocation opens a visible cmd.exe window on Windows because windowsHide: true is not passed when spawning hook processes. This causes constant black CMD windows popping up during work.

Impact: All stdin-based hooks are unusable on Windows, making the hook system effectively broken on this platform. Users who set up hooks get permanently frozen sessions that keep respawning.

What Should Happen?

  1. Hooks should receive stdin properly and close it so the hook process can exit
  2. Hook processes should spawn with windowsHide: true so no cmd.exe windows appear
  3. If a hook process hangs, Claude Code should time it out (e.g. 10 seconds) instead of freezing the entire session forever

Error Messages/Logs

Steps to Reproduce

  1. On Windows 10, add a PreToolUse hook to ~/.claude/settings.json that runs a node script reading stdin
  2. Use Claude Code normally — the session freezes on the first tool call
  3. Session shows "Stewing..." / "Wibbling..." forever, no tokens consumed
  4. Kill the session — Claude Desktop re-animates it via --resume, it freezes again
  5. Each hook invocation also opens a visible cmd.exe window

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

2.1.92

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Terminal.app (macOS)

Additional Information

Running Claude Desktop (Microsoft Store, UWP) v1.1617.0 on Windows 10 Home 10.0.19045. User profile path contains Hebrew characters which adds complexity but the core issue is stdin not closing for hook child processes regardless of path encoding.

extent analysis

TL;DR

Passing windowsHide: true when spawning hook processes and ensuring stdin is properly closed may resolve the issue of frozen sessions and visible cmd.exe windows on Windows.

Guidance

  • Verify that the node script is correctly handling stdin and that the issue is not with the script itself.
  • Check if passing windowsHide: true when spawning the hook process resolves the issue of visible cmd.exe windows.
  • Consider implementing a timeout for hook processes to prevent the entire session from freezing indefinitely.
  • Ensure that the stdin stream is being properly closed after the hook process has finished reading from it.

Example

const childProcess = require('child_process');

// When spawning the hook process
const hookProcess = childProcess.spawn('node', ['hook-script.js'], {
  stdio: ['pipe', 'pipe', 'pipe'],
  windowsHide: true // Add this option to hide the cmd.exe window
});

// Properly close stdin after the hook process has finished reading from it
hookProcess.stdin.end();

Notes

The issue may be related to the way the node script is handling stdin, and ensuring that it is properly closed may resolve the issue. Additionally, the user's profile path containing Hebrew characters may add complexity to the issue, but it is not the primary cause.

Recommendation

Apply a workaround by passing windowsHide: true when spawning hook processes and ensuring stdin is properly closed, as this may resolve the issue without requiring an upgrade to a fixed version.

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