2.1.27 已经修正Windows Shell 命令无法执行的问题
2.1.20 雀食该夯一回了
Windows shell指令 (No Content)
github.com/anthropics/claude-code
[BUG] Bash tool doesn't capture stdout from shell script files on Windows
已打开 03:23AM - 16 Jan 26 UTC
spragginsdesigns
bug has repro platform:windows area:tools oncall
## Description On Windows, the Bash tool does not capture stdout from **shell script files**. This affects all shell scripts, including npm CLI shims, custom scripts, and any executable shell script. ## Environment - **OS**: Windows 11 (10.0.26200) - **Node**: v22.21.0 - **Claude Code**: Started occurring around v2.1.x - **Shell**: Git Bash (MINGW64) ## Reproduction Steps ```bash # Create a simple shell script cat > /tmp/
test.sh << EOF #!/bin/sh echo "hello from script" EOF chmod +x /tmp/
test.sh # These produce NO output: /tmp/
test.sh sh /tmp/
test.sh bash /tmp/
test.sh # But these WORK: sh -c "echo hello" echo "echo hello" | sh bash -c "echo hello" ``` ## Expected Behavior Shell script files should have their stdout captured and returned, same as inline commands. ## Actual Behavior | Command Type | Output Captured? | |--------------|------------------| | `sh -c "echo hello"` | ✅ Yes | | `bash -c "echo hello"` | ✅ Yes | | `echo "cmd" \| sh` | ✅ Yes | | `node /path/to/script.js` | ✅ Yes | | `/path/to/script.sh` | ❌ No | | `sh /path/to/script.sh` | ❌ No | | `bash /path/to/script.sh` | ❌ No | Exit code is 0 (success), but stdout is empty. ## Impact This breaks **all npm CLI tools** on Windows because npm creates shell shims like: ```sh #!/bin/sh basedir=$(dirname ...) exec node "$basedir/node_modules/pkg/dist/main.js" "$@" ``` When Claude Code runs `linearis`, `prettier`, `eslint`, or any npm-installed CLI, no output is returned. ## Workaround Call node directly, bypassing the shell shim: ```bash # Instead of: linearis issues read LC-123 node /c/Users/Owner/AppData/Roaming/npm/node_modules/linearis/dist/main.js issues read LC-123 ``` Or use PowerShell wrapper: ```bash powershell.exe -Command "linearis issues read LC-123" ``` ## Possibly Related Changelog Entries - **v2.1.2**: "Changed large bash command outputs to be saved to disk instead of truncated" - **v2.1.0**: "Added unified Ctrl+B backgrounding for both bash commands and agents" These changes may have affected how stdout is captured from shell script file execution vs inline commands.
53 posts - 30 participants
Read full topic
via
LINUX DO - 热门话题 (author: 哈雷彗星)
Invalid media:
image