statusLine custom command deadlocks due to unclosed stdin pipe / missing EOF in v2.1.143
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?
When configuring a custom script for statusLine via settings.json (e.g., running a PowerShell script), the status line completely disappears or fails to display any output.
Deep debugging reveals that any attempt to read from stdin within the external process (such as [Console]::In.ReadToEnd(), ReadLine(), or even async Wait() mechanisms) blocks indefinitely. This happens because Claude Code pushes the JSON payload into the pipe but keeps the pipe open without signaling EOF or appending a trailing newline (\n).
Because Claude Code has a very tight internal timeout for the status line execution, the blocked script process is killed before it can return any stdout, resulting in a blank status line.
Notably, this issue began occurring mid-session today between 3:03 PM and 3:35 PM without a binary update, strongly suggesting that a server-side feature flag or a specific runtime state (potentially related to token tracking) altered Claude Code's pipe-handling behavior.
What Should Happen?
Claude Code should explicitly close the stdin pipe (signal EOF) or at least append a proper newline character after writing the statusLine JSON payload. This will allow external scripts to finish reading the stream and output the status line successfully without deadlocking.
Error Messages/Logs
No explicit error message is thrown in the terminal, but the status line remains entirely blank. Manual testing of the stream pipe confirms it hangs indefinitely waiting for EOF.
Steps to Reproduce
- Configure a custom command in ~/.claude/settings.json:
"statusLine": {
"type": "command",
"command": "powershell -NoProfile -File C:\\path\\to\\statusline-script.ps1"
}
- In statusline-script.ps1, attempt to read the JSON configuration payload from standard input:
$inputJson = [Console]::In.ReadToEnd()
# Or $inputJson = [Console]::In.ReadLine()
# The script hangs here indefinitely because no EOF or newline is received.
- Launch Claude Code (cc). The status line will be missing/blank because the script process is deadlocked and subsequently terminated by Claude Code's internal timeout.
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
The behavior worked properly on v2.1.143 earlier today before a runtime/session state shift triggered the pipe blockage.
Claude Code Version
v2.1.143
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
We attempted to implement an async workaround with a timeout wrapper in .NET Framework 4.x (e.g., $task.Wait(200)), but it still resulted in no output. This indicates that Claude Code's process lifecycle management for statusLine execution is highly aggressive (likely well below 200ms), meaning any amount of blocking on stdin will cause the script to be killed immediately.
Since "autoUpdates": false was set and the binary modification timestamp did not change between when it worked (3:03 PM) and when it broke (3:35 PM), this is a classic runtime session or remote-config triggered edge case.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗