Remove SIGTTOU handler before restoring foreground process group

When fish exits, it tries to restore the foreground process group.
However this may actually steal control of the fg process group
from another process. Fix this by clearing the SIGTTOU handler so
that tcsetpgrp() will fail.

Credit to @mqudsi for awesome debugging.

Fixes #7060
This commit is contained in:
ridiculousfish
2020-05-31 14:11:39 -07:00
parent 03208acb60
commit 3ae91f197d
4 changed files with 8 additions and 5 deletions

View File

@@ -528,7 +528,7 @@ int main(int argc, char **argv) {
event_fire_generic(parser, L"fish_exit", &event_args);
restore_term_mode();
restore_term_foreground_process_group();
restore_term_foreground_process_group_for_exit();
if (g_profiling_active) {
parser.emit_profiling(s_profiling_output_filename);