[BUG] Bash tool on Windows spawns visible console windows and doesn't capture stdout/stderr

Resolved 💬 3 comments Opened Mar 25, 2026 by nholthaus Closed Mar 29, 2026

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?

When using the Bash tool in Claude Code on Windows with WSL2:

  1. Every bash command spawns a visible Windows Terminal tab showing wsl.exe
  2. The Bash tool returns "(Bash completed with no output)" for all commands
  3. Only exit codes are captured; stdout and stderr are completely lost
  4. The run_in_background parameter prevents windows but still doesn't capture output

This makes the Bash tool essentially unusable on Windows without manually redirecting every command to a file.

Root cause analysis

Claude Code appears to be launching wsl.exe without:

  • Proper stdout/stderr pipe redirection
  • The CREATE_NO_WINDOW flag (or equivalent)

This causes Windows to spawn visible console windows and prevents output capture. The issue is in the Claude Code
harness's Windows process spawning code, not in user configuration.

What Should Happen?

  • Bash commands should execute silently without spawning visible windows
  • stdout and stderr should be captured and returned in the tool result
  • The Bash tool should work the same way it does on Linux/macOS

Error Messages/Logs

Environment:
  - OS: Windows 11 Enterprise 10.0.26100
  - Claude Code: Desktop app (Sonnet 4.5, us-gov.anthropic.claude-sonnet-4-5-20250929-v1:0)
  - Shell: WSL2 bash (Linux str-win-3878 5.15.167.4-microsoft-standard-WSL2)
  - Working directory: E:\workspace

  Tool result examples:
  Command: echo "test" && pwd && date
  Result: (Bash completed with no output)

  Command: ls /nonexistent 2>&1
  Result: Exit code 2
  (Note: Error exit codes ARE captured, but no error text)

  Command with run_in_background=true:
  Result: Command running in background with ID: xxx
  Output file contents: [only contains exit code, no stdout/stderr]

  Current workaround:
  command &> output.txt
  # Then use Read tool to read E:\workspace\output.txt

Steps to Reproduce

  1. Setup Windows Terminal profile (this is how we're running Claude Code):
  • Open Windows Terminal settings (Ctrl+,)
  • Click "Open JSON file"
  • Add this profile to the profiles.list array:

{
"guid": "{a3b2c1d0-e5f4-11eb-9a03-0242ac130003}",
"name": "Claude Code",
"commandline": "claude",
"startingDirectory": "%USERPROFILE%",
"colorScheme": "One Half Dark"
}

  • Save and launch Claude Code from the Windows Terminal dropdown
  1. Verify Windows Terminal default terminal setting:
  • In Windows Terminal settings → Startup → Default terminal application
  • Set to "Let Windows decide" (we tested with "Windows Terminal" as well - same issue)
  1. Run any bash command through Claude Code:

Use Bash tool with: echo "Hello" && pwd && date

  1. Observe:
  • A new Windows Terminal tab opens showing wsl.exe running the command
  • The tab closes when command completes
  • Tool result shows "(Bash completed with no output)"

Claude Model

None

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

Claude Sonnet 4.5 (model ID: us-gov.anthropic.claude-sonnet-4-5-20250929-v1:0)

Platform

AWS Bedrock

Operating System

Windows

Terminal/Shell

Windows Terminal

Additional Information

_No response_

View original on GitHub ↗

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