-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: add tty mux functionality to chroot2 #4163
base: master
Are you sure you want to change the base?
Conversation
This commit adds the ability to control the container's entrypoint process from multiple tty consoles. Mainly it's done to support the simultanious access to the container's console from the serial terminal and the VNC console. The `chroot2` script now accepts two additional argument which are the names of the tty consoles (serial and VNC) to be multiplexed. The script accepts inputs from both consoles and forwards them to the container's entrypoint stdin. The output from the container's entrypoint stdout and stderr is also multiplexed to both consoles. Additionally both consoles forward the common signals such as Ctrl+C, Ctrl+Z, Ctrl+\, Ctrl+D to the container's entrypoint process. Signed-off-by: Paul Gaiduk <[email protected]>
I fear with this approach https://linux.die.net/man/1/isatty will return false - have you tried it? |
yes, |
Lots of tools check on that and do a different output (https://codesearch.debian.net/search?q=isatty&literal=1 ) Let's say it is manageable ;-) |
I see. I had the issue that |
I guess it is busybox top vs procps-ng top. What about editors? |
@europaul I think you shoud use https://linux.die.net/man/3/posix_openpt and friends to have a pseudo terminal device and not a raw FD if you want terminal programs to work properly. I recommend reading chapter 64 "Pseudoterminals" in this book https://github.com/rangaeeeee/books-raspberrypimagazines/blob/master/The%20Linux%20Programming%20Interface-Michael%20Kerrisk.pdf |
Recently I made an attempt to upstream working mux implementation, but in QEMU. I got some feedback, the discussion is here: https://lists.gnu.org/archive/html/qemu-devel/2024-09/msg02968.html . The patch works as is, but obviously there are some things to be addressed if we want to make this upstream. @europaul , if you wish to continue this work, please feel free to take it. Also feel free to take the patch downstream if you give up on this one PR. |
This commit adds the ability to control the container's entrypoint process from multiple tty consoles. Mainly it's done to support the simultanious access to the container's console from the serial terminal and the VNC console.
The
chroot2
script now accepts two additional argument which are the names of the tty consoles (serial and VNC) to be multiplexed. The script accepts inputs from both consoles and forwards them to the container's entrypoint stdin. The output from the container's entrypoint stdout and stderr is also multiplexed to both consoles. Additionally both consoles forward the common signals such as Ctrl+C, Ctrl+Z, Ctrl+, Ctrl+D to the container's entrypoint process.