[BUG] PreToolUse hooks receive empty stdin on Windows
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?
Title: PreToolUse hooks receive empty stdin on Windows
Environment:
- OS: Windows (Git Bash)
- Claude Code version: [your version]
Description:
PreToolUse hooks configured for Bash tool fire correctly but receive empty stdin.
Documentation indicates hooks should receive JSON with tool_input.command.
Steps to reproduce:
- Create .claude/hooks/test.sh that writes stdin to file
- Register in settings.json as PreToolUse hook with matcher "Bash"
- Run any bash command
- Check output file - stdin length is 0
Expected: stdin contains {"hook_event_name":"PreToolUse","tool_name":"Bash","tool_input":{"command":"..."}}
Actual: stdin is empty
Impact: Cannot implement hooks that filter by command content
What Should Happen?
Expected: stdin contains {"hook_event_name":"PreToolUse","tool_name":"Bash","tool_input":{"command":"..."}}
Actual: stdin is empty
Error Messages/Logs
Steps to Reproduce
Steps to reproduce:
- Create .claude/hooks/test.sh that writes stdin to file
- Register in settings.json as PreToolUse hook with matcher "Bash"
- Run any bash command
- Check output file - stdin length is 0
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
Claude Code version 2.1.4
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Other
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗