[BUG] claude code input stream json hang
Environment
- Platform (select one):
- [ ] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [x ] Other: claude code<!-- specify -->
- Claude CLI version: 1.44 <!-- output of
claude --version--> - Operating System: win 11<!-- e.g. macOS 14.3, Windows 11, Ubuntu 22.04 -->
- Terminal: wsl via cmd or wsl, called via c# process redirection<!-- e.g. iTerm2, Terminal App -->
Bug Description
Running headless or print mode is much more slower than running it interactively.
I have a success running print mode and continue with session id but every turn unbearably slow. Using stream json as input, i can have the first conversation result and then i send the 2nd user message jsonl message, it just hang.
Could be caused by calling wsl via cmd in dotnet process class, could be something else. Is anyone has success with input stream json?
<!-- A clear and concise description of the bug -->
Steps to Reproduce
- <!-- First step --> call claude code in wsl piped with cmd in dotnet process class, cant make this step work with wsl for some reason, it has to be via cmd
- Got 3 responses json output, system init, assistant, result
- Send stdin writeLine json user message, flush
Expected Behavior
<!-- What you expected to happen -->
Got next responses
Actual Behavior
<!-- What actually happened -->
It just hang, no error
Maybe debug mode with timeout will be nice
Additional Context
<!-- Add any other context about the problem here, such as screenshots, logs, etc. -->
When i run it in cmd directly, it also stop within one turn
I think the best solution is to improve the headless mode start performance as interactive mode
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗