[BUG] Bash tool produces no output when executing scripts on Windows/MSYS2
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?
## Summary
When using Claude Code's Bash tool on Windows (MSYS2/Git Bash), executing shell scripts directly produces zero output. The
same scripts work correctly when run via source or in a clean environment with env -i.
## Environment
- Platform: Windows 10/11 with MSYS2 (Git Bash)
- Shell:
/usr/bin/bash(MSYS2) - Claude Code version: (current as of 2026-01-20)
What Should Happen?
All execution methods should produce output:
Error Messages/Logs
Steps to Reproduce
## Reproduction Steps
- Create a simple test script:
``bash``
cat > /tmp/test-script.sh << 'EOF'
#!/usr/bin/env bash
echo "stdout from script"
echo "stderr from script" >&2
EOF
chmod +x /tmp/test-script.sh
- Execute via different methods:
```bash
# These produce NO OUTPUT:
/tmp/test-script.sh
./tmp/test-script.sh
bash /tmp/test-script.sh
/usr/bin/bash /tmp/test-script.sh
cat /tmp/test-script.sh | bash
# These WORK correctly:
source /tmp/test-script.sh # Output: both lines
eval "$(cat /tmp/test-script.sh)" # Output: both lines
env -i PATH="..." bash /tmp/test-script.sh # Output: both lines
```
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.12 (Claude Code)
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
Seems like the output is not being harvested from sub-processes. I think I have ruled out any issues with my script.
This issue has 10 comments on GitHub. Read the full discussion on GitHub ↗