claude-code - 💡(How to fix) Fix statusLine: external binaries produce no captured stdout — requires bash -c wrapper [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#47071Fetched 2026-04-13 05:42:15
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Author
Timeline (top)
labeled ×4commented ×1

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.

Error Message

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. // Does NOT work — statusline empty, no error

Root Cause

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.

Fix Action

Workaround

Wrap the command in bash -c '...':

"command": "bash -c 'python3 /path/to/script.py'"

Code Example

// 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'"
  }
}

---

"command": "bash -c 'python3 /path/to/script.py'"
RAW_BUFFERClick to expand / collapse

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

CommandTypeOutput captured?
echo TESTbash builtinYes
printf 'text'bash builtinYes
py statusline.pyexternal binaryNo
python statusline.pyexternal binaryNo
/full/path/to/python statusline.pyexternal, full pathNo
python -c "print('X')"external, inlineNo
bash -c 'python -c "print(X)"'external via bash -cYes
bash -c 'py statusline.py'external via bash -cYes

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'"

extent analysis

TL;DR

Wrap external binary commands in bash -c '...' to capture their output in statusLine.command.

Guidance

  • The issue seems to be related to how Claude Code handles external binaries versus bash builtins, suggesting a difference in how output is captured.
  • To verify the issue, try running the external binary command manually and check if it produces the expected output.
  • As a workaround, wrapping the command in bash -c '...' resolves the issue, as shown in the provided examples.
  • Ensure that the path to the external binary is correct, although the issue persists even with the full path specified.

Example

{
  "statusLine": {
    "type": "command",
    "command": "bash -c 'python3 /path/to/script.py'"
  }
}

Notes

The root cause of the issue is not explicitly stated, but it appears to be related to how Claude Code interacts with external binaries. The provided workaround is effective but may not address the underlying issue.

Recommendation

Apply the workaround by wrapping external binary commands in bash -c '...', as it consistently resolves the issue of capturing output in statusLine.command.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

External binaries in statusLine.command should have their stdout captured the same way bash builtins do.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix statusLine: external binaries produce no captured stdout — requires bash -c wrapper [1 comments, 2 participants]