patch 7.4.1669
Problem: When writing buffer lines to a pipe Vim may block.
Solution: Avoid blocking, write more lines later.
diff --git a/src/os_unix.c b/src/os_unix.c
index 74ffe93..dc8e009 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -5539,7 +5539,8 @@
# endif
#endif
#ifndef HAVE_SELECT
- struct pollfd fds[6 + MAX_OPEN_CHANNELS];
+ /* each channel may use in, out and err */
+ struct pollfd fds[6 + 3 * MAX_OPEN_CHANNELS];
int nfd;
# ifdef FEAT_XCLIPBOARD
int xterm_idx = -1;
@@ -5652,7 +5653,7 @@
struct timeval tv;
struct timeval *tvp;
- fd_set rfds, efds;
+ fd_set rfds, wfds, efds;
int maxfd;
long towait = msec;
@@ -5685,6 +5686,7 @@
*/
select_eintr:
FD_ZERO(&rfds);
+ FD_ZERO(&wfds);
FD_ZERO(&efds);
FD_SET(fd, &rfds);
# if !defined(__QNX__) && !defined(__CYGWIN32__)
@@ -5725,10 +5727,10 @@
}
# endif
# ifdef FEAT_JOB_CHANNEL
- maxfd = channel_select_setup(maxfd, &rfds);
+ maxfd = channel_select_setup(maxfd, &rfds, &wfds);
# endif
- ret = select(maxfd + 1, &rfds, NULL, &efds, tvp);
+ ret = select(maxfd + 1, &rfds, &wfds, &efds, tvp);
result = ret > 0 && FD_ISSET(fd, &rfds);
if (result)
--ret;
@@ -5810,7 +5812,7 @@
# endif
#ifdef FEAT_JOB_CHANNEL
if (ret > 0)
- ret = channel_select_check(ret, &rfds);
+ ret = channel_select_check(ret, &rfds, &wfds);
#endif
#endif /* HAVE_SELECT */