From b4aa2b7c2cdd640f4f5e1fb9efd37bb280573c89 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Fri, 27 Feb 2015 09:53:57 -0800 Subject: Allow fish to properly exit from job_continue when receiving a signal e340baf6cc introduced a bug where fish would not exit from job_continue when receiving a signal like SIGHUP. This means that it would not in turn deliver SIGHUP to its children, who would therefore never exit. Those children may attempt to write to stdout, in which case they would receive EIO; this can cause other weird issues, like telnet using 100% CPU. Fixes #1958 --- proc.cpp | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/proc.cpp b/proc.cpp index e6e0a8ed..7caf2d6c 100644 --- a/proc.cpp +++ b/proc.cpp @@ -1225,15 +1225,13 @@ void job_continue(job_t *j, bool cont) if (job_get_flag(j, JOB_FOREGROUND)) { - bool quit = false; - /* Look for finished processes first, to avoid select() if it's already done. */ process_mark_finished_children(false); /* Wait for job to report. */ - while (! job_is_stopped(j) && ! job_is_completed(j)) + while (! reader_exit_forced() && ! job_is_stopped(j) && ! job_is_completed(j)) { // debug( 1, L"select_try()" ); switch (select_try(j)) @@ -1261,23 +1259,11 @@ void job_continue(job_t *j, bool cont) speed boost (A factor 3 startup time improvement on my 300 MHz machine) on short-lived jobs. + + This will return early if we get a signal, + like SIGHUP. */ - int processed = process_mark_finished_children(true); - if (processed < 0) - { - /* - This probably means we got a - signal. A signal might mean that the - terminal emulator sent us a hup - signal to tell is to close. If so, - we should exit. - */ - if (reader_exit_forced()) - { - quit = 1; - } - - } + process_mark_finished_children(true); break; } } -- cgit v1.2.3