[BUG] Stdout is thrown away if a local command has non-zero exit status
Environment
- Platform (select one):
- [x] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other: <!-- specify -->
- Claude CLI version: 1.0.30 (Claude Code)
- Operating System: Ubuntu 24.04
- Terminal: VSCode
Bug Description
When I want to typecheck a Nuxt v3 project, I want to use
yarn typecheck
which is a package.json script that expands to
nuxt typecheck
CC tries to run the first command, reports Error: Error and then goes ona wild goose chase to try variations of it.
In the end, the problem is that nuxt typecheck (correctly) reports a non-zero error status if there are typing issues, but the actual issues are reported on stdout. On the general "process exited with non-zero status" is on stderr. It seems stdout is thrown away if the command "fails."
Looking at deobfuscated code, it seems you are using stdout for something, but either the error has strong priority over it, or it's lost somewhere.
When I instruct Claude Code to append | cat so the pipeline always succeeds, it works.
I assume this issue is also valid for other tools, so I think the CLI should handle it better in general.
Steps to Reproduce
- Ask it to run something like
echo Hello ; exit 1and see if it sees the Hello.
Expected Behavior
That it can use the typing issues found by the command.
Actual Behavior
Error: Error and it thinks it screwed up the command invocation.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗