Interactive stdin prompts don't work in Bash tool (e.g. gh secret set)
Description
When running commands that require interactive stdin input via the ! prefix (user-executed bash commands within Claude Code), the prompt never appears and the command completes silently without setting the value.
The ! prefix is documented as a way to run shell commands directly within the Claude Code session so their output lands in the conversation. However, it does not support interactive stdin prompts.
Steps to Reproduce
- Inside a Claude Code session, type:
! gh secret set MY_SECRET - Expected: interactive prompt asking for the secret value (as it would in a normal terminal)
- Actual: command completes immediately with no output and no prompt — the secret is not set
This also happens when Claude's agent suggests the user run a command via ! and the command requires interactive input.
Impact
Users working with secrets are forced to use --body flag which exposes the secret value in the conversation history, or pipe with echo which leaves it in shell history. Neither is ideal for sensitive values.
This is particularly problematic for secret/credential setup flows where the interactive prompt exists specifically to avoid exposing sensitive values in command arguments or shell history.
Workaround
Use echo "value" | gh secret set SECRET_NAME or set secrets via the GitHub web UI.
Environment
- Claude Code CLI on Windows 11
- Shell: bash (Git Bash / MINGW64)
- gh CLI v2.x
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗