Open jazzdelightsme opened 6 years ago
Suppose this feature were implemented with a --tty-input
switch. That would allow writing the following function:
function Enter-ContainerShell( $containerName )
{
$lf = "'n"
# Send LF to "tickle" container shell so we see a prompt:
docker attach $containerName --tty-input $lf
}
Mockup:
PS C:\src\thing> Enter-ContainerShell thirsty_wright
PS />
If you try to pipe some input when attaching to a container that has a TTY, you are told it can't work:
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:
It would be really handy to be able to ask
attach
, hey, once you have yourhijackedIOStreamer
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.