claude --print silently exits with zero output (v2.1.83)
Resolved 💬 3 comments Opened Mar 25, 2026 by ao92265 Closed Mar 29, 2026
Description
claude --print / claude -p exits with code 0 but produces zero output on stdout and stderr. This makes it impossible to use Claude Code as a subprocess for automation tools.
Reproduction
claude -p 'Say hello' > /tmp/test.txt 2>&1
echo $? # outputs: 0
cat /tmp/test.txt # empty
Also tested:
- With/without
< /dev/null - From tmux with all CLAUDE* env vars unset
- From /tmp (no .claude/ directory)
- With
--verboseflag - Using full binary path
/Users/username/.local/bin/claude
All produce exit 0 with zero output.
Environment
- Claude Code v2.1.83
- macOS Darwin 25.2.0
- Node.js v22.13.1
- Auth: OAuth (subscription)
Impact
Blocks any tool that uses claude --print as a subprocess (e.g., Agent Control Tower, CI/CD automation, scripting).
Expected
claude --print 'Say hello' should output the model's response to stdout.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗