ctop causes docker containers to exit prematurely (via SIGIO)
I've found that after running ctop, docker containers that are run with -t (allocate pseudo TTY) in the same shell as ctop, will be interrupted with SIGIO. This is notably only noticeable if you are using an init process that rewires signal handlers, like dumb-init. If you don't use an init process like dumb-init, the process will be run with pid=1, which is special: linux’s default signal handlers that cause a process to exit are not installed, and so SIGIO is silently swallowed. See: https://github.com/Yelp/dumb-init#why-you-need-an-init-system
My hypothesis is that this may betermui-related, but I don't know enough about that library / Go to explore a more minimal repro that doesn't involve ctop.
Steps to reproduce the problem:
- Open a new terminal.
- Run
ctopand then exit (or evenctop &) - In the same terminal window, run
docker run --rm -it joelnb/dumb-init-ubuntu bash -c 'read -p Name: name && echo "Hi ${name}!" - Press any key on the keyboard.
What went wrong?
Instead of sending the character to stdin, the docker container immediately exits. Running echo $? shows exit code 157, which corresponds to unhandled signal 29 (SIGIO).
What is the expected behavior?
The docker container should not exit and should keep capturing keyboard input, where upon hitting enter, prints "Hi <whatever you typed>"
Example output
Good behavior followed by bad behavior
$ docker run --rm -it joelnb/dumb-init-ubuntu bash -c 'read -p Name: name && echo "Hi ${name}!"'
Name:Saif
Hi Saif!
$ echo $?
0
$ ctop
$ docker run --rm -it joelnb/dumb-init-ubuntu bash -c 'read -p Name: name && echo "Hi ${name}!"'
Name:S
$ echo $?
157
Software Versions
OS: macOS 10.15.7
Docker Desktop: 3.6.0.5487
Shell: bash 3.2.57 and zsh 5.7.1
Terminal emulator: iTerm2 3.4.8 and Terminal 2.10
ctop: 0.7.6 (installed via brew)
I'm unable to replicate this; either via the ctop-and-exit or background methods - can you confirm whether you're still seeing this behavior in the latest release?
On Ubuntu 20.04 (64-bit) it's not happening either:

I run ctop version 0.7.7.