[BUG] CC runs bash commands with stdin always connected

Resolved 💬 5 comments Opened Sep 23, 2025 by nikita2206 Closed Jan 8, 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 CC runs bash commands it seems to always open their STDIN pipe even if it doesn’t intend to send anything to it.

This throws off special handling of stdin in applications that handle it as a special case, e.g. I have a linter that will normaly lint all files but if STDIN is open then it expects a list of files there.

As a workaround, I’ve found that I can check if the stdin is empty.

What Should Happen?

STDIN should not be open if there is no intention to send anything over it

Error Messages/Logs

Steps to Reproduce

Small reproducer:

#!/usr/bin/env python3
import sys

if sys.stdin.isatty():
    print("stdin is not redirected (no pipe)")
else:
    print("stdin is redirected (pipe or file)")

Running it manually vs CC

❯ python test-stdin.py 
stdin is not redirected (no pipe)

❯ echo "" | python test-stdin.py
stdin is redirected (pipe or file)

❯ claude --dangerously-skip-permissions -p "run python test-stdin.py and show its output"
The script outputs: `stdin is redirected (pipe or file)`

Claude Model

None

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

1.0.120

Platform

Anthropic API

Operating System

Other Linux

Terminal/Shell

Other

Additional Information

_No response_

View original on GitHub ↗

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