changeset 8845:210e767296d9 v7.4.1710

commit https://github.com/vim/vim/commit/17fe5e1aecbeff5ca4b2a821ede9badd5dddae59 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Apr 4 22:03:08 2016 +0200 patch 7.4.1710 Problem: Not all output of an external command is read. Solution: Avoid timing out when the process has exited. (closes https://github.com/vim/vim/issues/681)
author Christian Brabandt <cb@256bit.org>
date Mon, 04 Apr 2016 22:15:31 +0200
parents d526a0ea94b3
children 2dd1060c5155
files src/os_unix.c src/version.c
diffstat 2 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -4845,6 +4845,7 @@ mch_call_shell(
 			    break;
 
 # if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H)
+			if (wait_pid == 0)
 			{
 			    struct timeval  now_tv;
 			    long	    msec;
@@ -4854,7 +4855,7 @@ mch_call_shell(
 			     * break out too often to avoid losing typeahead. */
 			    gettimeofday(&now_tv, NULL);
 			    msec = (now_tv.tv_sec - start_tv.tv_sec) * 1000L
-				+ (now_tv.tv_usec - start_tv.tv_usec) / 1000L;
+				 + (now_tv.tv_usec - start_tv.tv_usec) / 1000L;
 			    if (msec > 2000)
 			    {
 				noread_cnt = 5;
@@ -4864,10 +4865,15 @@ mch_call_shell(
 # endif
 		    }
 
-		    /* If we already detected the child has finished break the
-		     * loop now. */
+		    /* If we already detected the child has finished, continue
+		     * reading output for a short while.  Some text may be
+		     * buffered. */
 		    if (wait_pid == pid)
+		    {
+			if (noread_cnt < 5)
+			    continue;
 			break;
+		    }
 
 		    /*
 		     * Check if the child still exists, before checking for
--- a/src/version.c
+++ b/src/version.c
@@ -749,6 +749,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1710,
+/**/
     1709,
 /**/
     1708,