Closed stesser closed 8 months ago
Somewhat surprisingly, this seems to be bash-related. I can reproduce it if my primary login shell is bash, but not if it's fish (which I usually use). If I login with fish and then invoke bash, I cannot reproduce it.
I've bisected the bug to 2da291acf8b41d5a96332b2450286872e444a787 .
I'd guess that fish performs a reset of TTY parameters to values suitable for interactive use, while bash does not?
Maybe using crossterm instead of termion needs some additional uninit() code?
And I'd think that output tty settings should not be modified at all when output is not to a TTY (but to a file or pipe). I can see that you may want "-icanon" to read single character commands, though (but then exit could also be caused by a signal or the output having been closed).
gstat-rs isn't intended for non-interactive use. For that, you should use iostat. And what does "-icanon" refer to? Are those command line flags for something?
The "-icanon" came from the stty output (ICANON bit is cleared in the c_lflags element of struct termios). This setting disables any input processing or buffering of TTY input.
With regard to only interactive use of gstat-rs: I'd expect most uses to be interactive, but "gstat -B" supports logging of performance data in batch mode, and I consider this a valid use case, too (and actually use it at times ...)
After exiting from gstat-rs by pressing "q", the TTY state is often not correctly restored:
The output of "stty" (command not echoed on entry) is:
The normal stty outoput is:
I'm using bash in a SSH session ...