[Feature Request] Allow sending some input through TTY when attaching
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 6.1k
- Forks
- 2.2k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 43
Description
If you try to pipe some input when attaching to a container that has a TTY, you are told it can't work:
PS C:\src\thing> "`n" | docker attach mycontainer
the input device is not a TTY. If you are using mintty, try prefixing the command with 'winpty'
This makes sense, because a string is not a terminal interface (TTY).
However, it would be really handy to be able to send some input through the actual TTY once it is hooked up.
The use case I am considering is a container that is running an interactive shell (with TTY). When you attach to such a container, assuming the shell is just sitting there idle, you don't see any indication that you're hooked up--no prompt or anything. The documentation even spells this out:
"This can appear as if the attach command is hung when in fact the process may simply not be interacting with the terminal at that time."
It would be really handy to be able to ask attach, hey, once you have your hijackedIOStreamer hooked up, could you please send along this text through it? This would allow, for example, sending a newline to an otherwise idle shell, triggering a new prompt to be output, without requiring the user to know that they need to bang on the enter key a few times until they get a prompt.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the docker attach entry point and the hijackedIOStreamer hookup described in the issue. Determine how an input value could be delivered after the TTY is connected, then verify that an idle interactive shell can receive it and produce its prompt without breaking normal attach behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100