]> git.ipfire.org Git - thirdparty/git.git/commit
terminal: restore settings on SIGTSTP
authorPhillip Wood <phillip.wood@dunelm.org.uk>
Wed, 16 Mar 2022 18:54:05 +0000 (18:54 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 16 Mar 2022 19:24:44 +0000 (12:24 -0700)
commit0f584debc74afefdd24449136ffb2c77859e38c9
tree28720b410f21c5df16aec6163ec1ba1bd5a19d1b
parent6606d99bae4161289d498b51a21acd11aa09e6ef
terminal: restore settings on SIGTSTP

If the user suspends git while it is waiting for a keypress reset the
terminal before stopping and restore the settings when git resumes. If
the user tries to resume in the background print an error
message (taking care to use async safe functions) before stopping
again. Ideally we would reprint the prompt for the user when git
resumes but this patch just restarts the read().

The signal handler is established with sigaction() rather than using
sigchain_push() as this allows us to control the signal mask when the
handler is invoked and ensure SA_RESTART is used to restart the
read() when resuming.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
compat/terminal.c