]> git.eshelyaron.com Git - emacs.git/commitdiff
Avoid returning early reading process output due to SIGIO
authorIan Kelling <ian@iankelling.org>
Mon, 6 Jul 2015 01:14:25 +0000 (18:14 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 6 Jul 2015 02:21:49 +0000 (19:21 -0700)
* src/process.c (wait_reading_process_output): Extend the behavior of
not breaking due to not finding output when a timer has lowered the
timeout to include when SIGIO lowers the timeout.

src/process.c

index 8e046a6dd1107903f479950c57893e1feefa9a0e..8a8dad793ade07ca028017b41e46c69123b7ca51 100644 (file)
@@ -4960,12 +4960,18 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
 
       if (nfds == 0)
        {
+          /* Exit the main loop if we've passed the requested timeout,
+             or aren't skipping processes and got some output and
+             haven't lowered our timeout due to timers or SIGIO and
+             have waited a long amount of time due to repeated
+             timers.  */
          struct timespec now = current_timespec ();
-         if ((timeout.tv_sec == 0 && timeout.tv_nsec == 0)
+          if (wait < TIMEOUT
              || (wait == TIMEOUT && timespec_cmp (end_time, now) <= 0)
              || (!process_skipped && got_some_output > 0
                  && (!timespec_valid_p (got_output_end_time)
-                     || timespec_cmp (got_output_end_time, now) <= 0)))
+                     || timespec_cmp (got_output_end_time, now) <= 0)
+                 && (timeout.tv_sec > 0 || timeout.tv_nsec > 0)))
            break;
        }