Bug Report: Claude Code Stop hook does not receive stdin on Windows (PowerShell 5.1 + pwsh 7)
Reporters: Kousei Izumida & ClaudeChat (Claude Sonnet 4.6)
---
Environment
- OS: Windows 11
- PowerShell: 5.1.26100.8115
- Claude Code: v2.1.101
- pwsh: 7.x (C:\Program Files\PowerShell\7\pwsh.exe)
- bash: not present (where.exe bash returns no result)
---
Issue Summary
The Stop hook does not deliver stdin to the handler script on Windows when using pwsh as the executor.
Specifically:
[Console]::IsInputRedirectedreturnsFalseinside the hook script- A full diagnostic dump script (checking stdin, environment variables, and command-line arguments) produced an empty log file
- No data was received through any channel
The UserPromptSubmit hook using identical pwsh configuration works correctly and returns additionalContext as expected.
---
Configuration (settings.json hooks section)
"hooks": {
"UserPromptSubmit": [{
"hooks": [{
"type": "command",
"command": "pwsh -ExecutionPolicy Bypass -File C:\Users\kouse\.claude\hooks\inject-constraints.ps1"
}]
}],
"Stop": [{
"hooks": [{
"type": "command",
"command": "pwsh -ExecutionPolicy Bypass -File C:\Users\kouse\.claude\hooks\block-self-judgment.ps1"
}]
}]
}
---
Steps to Reproduce
- Install Claude Code v2.1.101 on Windows with pwsh 7 (no bash)
- Register a Stop hook pointing to a pwsh script
- In the script, check
[Console]::IsInputRedirectedand log all incoming data - Trigger the Stop hook by completing a Claude Code session turn
- Observe: log file is empty,
IsInputRedirected = False
Expected: Stop hook receives JSON context via stdin as documented
Actual: stdin is empty, IsInputRedirected = False
---
Note
We are using hooks to enforce output constraints (blocking self-judgment phrases) as a governance layer for an AI automation pipeline. This issue prevents the Stop hook from functioning as a structural safety gate on Windows.
We would appreciate guidance on:
- Whether stdin delivery for Stop hooks is supported on Windows
- Whether there is an alternative delivery method (env vars, args) on Windows
- Whether this is a known issue with a workaround
---
Sincerely,
Kousei Izumida & ClaudeChat
MIRAI AI Orchestra
Iwaki, Fukushima, Japan
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗