aboutsummaryrefslogtreecommitdiffhomepage
path: root/proc.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2015-02-27 09:53:57 -0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2015-02-27 09:56:19 -0800
commitb4aa2b7c2cdd640f4f5e1fb9efd37bb280573c89 (patch)
tree9d4ecb0e601057166dba0e3a8d2356fd044b04f1 /proc.cpp
parentdd595dd1105b45cf0fe474d3d57fd1612653bd3d (diff)
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
Diffstat (limited to 'proc.cpp')
-rw-r--r--proc.cpp24
1 files 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;
}
}