[BUG] Bash tool lacks clear return codes and completion signals when running commands with ampersand to background
## Environment
- Platform (select one):
- [x] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other: <!-- specify -->
- Claude CLI version: 1.0.51 (Claude Code), also present in 1.0.44
- Operating System: macOS (Darwin 24.5.0)
- Terminal: iTerm2 3.4.15, using SuperClaude and Nix Shell for environment configuration
## Bug Description
Claude is not looking for clear return codes or completion signals to indicate when a command has finished executing when using &. This means that it takes significantly longer to run bash commands as it's relying on the timeout to detect completion. I asked Claude to detail what how it's configured to use the bash tool and it has drafted this bug in light of it's own understanding on how to use the tool.
## Steps to Reproduce
- Use the Bash tool to execute any long-running command and includes a background process using ampersand
&(e.g.,run-server.sh &) - The command will complete execution, but Claude will not realise that it's completed and continue waiting.
- After the timeout (2 min default) Claude continues
## Expected Behavior
Claude should be able to reliably understand when a bash command has completed:
- Explicit return code from the executed command (0 for success, non-zero for failure)
- Clear completion status (completed/timeout/interrupted)
- Structured response that distinguishes between streaming output and final result
## Actual Behavior
The tool response only contains output wrapped in <error> tags without any explicit completion indicators, making it impossible to
programmatically determine if a command has finished or is still executing with streamed output.
## Additional Context
This creates ambiguity about command completion status and can lead to incorrect assumptions about whether commands are still running
or have finished executing. The issue affects all commands that may produce streaming output.
This issue has 8 comments on GitHub. Read the full discussion on GitHub ↗