From 7dbf6695ff66c0ba1ab85ffbdb41173a665bafdc Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Fri, 24 Aug 2001 02:17:15 +0000 Subject: [PATCH] * subshell.c (feed_subshell): Don't wait forever after the first select() call if fail_on_error is true. This alleviates hang with zsh on QNX Neutrino. --- src/ChangeLog | 6 ++++++ src/subshell.c | 9 +++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 80be8e7c8..10eaefc90 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2001-08-23 Pavel Roskin + + * subshell.c (feed_subshell): Don't wait forever after the first + select() call if fail_on_error is true. This alleviates hang + with zsh on QNX Neutrino. + 2001-08-21 Pavel Roskin * view.h: Declare view_dlg. diff --git a/src/subshell.c b/src/subshell.c index 1b0a39489..11c28bfdd 100644 --- a/src/subshell.c +++ b/src/subshell.c @@ -986,12 +986,12 @@ static int feed_subshell (int how, int fail_on_error) struct timeval *wptr; /* }}} */ - /* we wait up to 10 seconds if fail_on_error */ + /* we wait up to 10 seconds if fail_on_error, forever otherwise */ wtime.tv_sec = 10; wtime.tv_usec = 0; + wptr = fail_on_error ? &wtime : NULL; - for (wptr = fail_on_error ? &wtime : NULL;;) - { + while (1) { if (!subshell_alive) return FALSE; @@ -1014,9 +1014,6 @@ static int feed_subshell (int how, int fail_on_error) } /* }}} */ - /* From now on: block forever on the select call */ - wptr = NULL; - if (FD_ISSET (subshell_pty, &read_set)) /* {{{ Read from the subshell, write to stdout */