Windows Git Bash: Script execution doesn't capture stdout

Resolved 💬 2 comments Opened Jan 16, 2026 by hekatonsure Closed Jan 16, 2026

Description

When running bash scripts in Claude Code's sandbox on Windows (Git Bash/MINGW64), stdout from script execution is not captured. The scripts run successfully but produce no visible output.

Environment

  • Platform: Windows (Git Bash / MINGW64)
  • Shell: /usr/bin/bash (Bash 5.2.37)
  • MSYSTEM: MINGW64

Steps to Reproduce

  1. Create a simple test script:
printf '#!/usr/bin/env bash\necho "hello from script"\n' > /tmp/test_script.sh
chmod +x /tmp/test_script.sh
  1. Run the script via Claude Code's Bash tool:
/tmp/test_script.sh
# or
bash /tmp/test_script.sh

Result: No output captured (shows "Tool ran without output or errors")

  1. Run with source or eval:
source /tmp/test_script.sh
# or
eval "$(cat /tmp/test_script.sh)"

Result: Output correctly captured: hello from script

Expected Behavior

Script execution via ./script or bash script should capture stdout the same way direct commands do.

Actual Behavior

  • Direct commands (echo "test") → output captured ✓
  • source script.sh → output captured ✓
  • eval "$(cat script.sh)" → output captured ✓
  • ./script.sh → no output captured ✗
  • bash script.sh → no output captured ✗
  • cat script.sh | bash → no output captured ✗

Impact

Any CLI tools implemented as bash scripts (common pattern) cannot be used effectively within Claude Code on Windows. The scripts execute correctly but their output is invisible, making them unusable for interactive workflows.

Workaround

Currently the only workarounds are:

  1. Use source to run scripts in the current shell context (breaks scripts with exit or conflicting variables)
  2. Have users run commands manually outside Claude Code and paste output

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗