[BUG] Windows: hooks using stdin freeze sessions indefinitely, cmd.exe windows pop up
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] 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:
- Hook spawns
node.exewhich reads stdin viaprocess.stdin.on('end', ...) - On Windows, stdin is never properly closed to the child process
- The node process hangs forever waiting for EOF
- Claude Code waits for the hook to complete → entire session freezes
- Session shows "Stewing..." / "Wibbling..." / "Crafting..." but never progresses, consumes no tokens
- 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?
- Hooks should receive stdin properly and close it so the hook process can exit
- Hook processes should spawn with windowsHide: true so no cmd.exe windows appear
- 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
- On Windows 10, add a PreToolUse hook to
~/.claude/settings.jsonthat runs a node script reading stdin - Use Claude Code normally — the session freezes on the first tool call
- Session shows "Stewing..." / "Wibbling..." forever, no tokens consumed
- Kill the session — Claude Desktop re-animates it via --resume, it freezes again
- 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.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗