[Libguestfs] [PATCH] fish: reset the console on ^Z RHBZ#1213844

Maros Zatko
Tue, 08 Mar 2016 19:49:00 -0000

Patch registers SIGTSTP hook where it sends reset terminal color
control sequence using write and fsync.
Handler is installed only if signal is not being ignored.

Patch uses rl_free_line_state and rl_cleanup_after_signal to unhook
readline from terminal, then it calls original TSTP handler using
approach in URL below and again hooks readline using
rl_reset_after_signal.

Handling is based on code from:
http://man7.org/tlpi/code/online/dist/pgsjc/handling_SIGTSTP.c.html

This approach seems to mostly work. User is sometimes able to get
readline into state when it doesn't correctly respond to newline.
^Z and subsequent fg helps there as reset command helps broken
terminal. I haven't noticed this using previous approach copied from vi.
If you know what is going on I'll be more than happy to fix it.

Maros

Maros Zatko (1):
  fish: reset the console on ^Z RHBZ#1213844

 fish/fish.c | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 76 insertions(+)

--
2.5.0