statusLine: external binaries produce no captured stdout — requires bash -c wrapper
Description
When configuring statusLine.command in ~/.claude/settings.json, external binaries (py, python, python3, and likely any non-builtin command) produce no captured output. The statusline remains empty with no error message.
Bash builtins (echo, printf) work correctly. Wrapping the external command in bash -c '...' resolves the issue.
Reproduction
// Does NOT work — statusline empty, no error
{
"statusLine": {
"type": "command",
"command": "python3 /path/to/statusline.py"
}
}
// Works correctly
{
"statusLine": {
"type": "command",
"command": "bash -c 'python3 /path/to/statusline.py'"
}
}
Systematic test results
| Command | Type | Output captured? |
|---------|------|-----------------|
| echo TEST | bash builtin | Yes |
| printf 'text' | bash builtin | Yes |
| py statusline.py | external binary | No |
| python statusline.py | external binary | No |
| /full/path/to/python statusline.py | external, full path | No |
| python -c "print('X')" | external, inline | No |
| bash -c 'python -c "print(X)"' | external via bash -c | Yes |
| bash -c 'py statusline.py' | external via bash -c | Yes |
Diagnostic details
- The script produces correct output when run manually (
echo JSON | py statusline.py) - A debug wrapper confirmed Claude Code does send JSON to stdin and the script does produce stdout — but the output is not captured/displayed
- Full path to the binary does not help
- The pattern is consistent: bash builtins work, external binaries don't
Environment
- Claude Code v2.1.92
- Windows 11 Pro 10.0.26200
- Python 3.13.12 (py launcher)
- Terminal: Windows Terminal + bash
Expected behavior
External binaries in statusLine.command should have their stdout captured the same way bash builtins do.
Workaround
Wrap the command in bash -c '...':
"command": "bash -c 'python3 /path/to/script.py'"This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗