1
0
forked from aniani/vim

patch 7.4.1710

Problem:    Not all output of an external command is read.
Solution:   Avoid timing out when the process has exited. (closes #681)
This commit is contained in:
Bram Moolenaar
2016-04-04 22:03:08 +02:00
parent 4c9ce053d9
commit 17fe5e1aec
2 changed files with 11 additions and 3 deletions

View File

@@ -4845,6 +4845,7 @@ mch_call_shell(
break; break;
# if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H) # if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H)
if (wait_pid == 0)
{ {
struct timeval now_tv; struct timeval now_tv;
long msec; long msec;
@@ -4854,7 +4855,7 @@ mch_call_shell(
* break out too often to avoid losing typeahead. */ * break out too often to avoid losing typeahead. */
gettimeofday(&now_tv, NULL); gettimeofday(&now_tv, NULL);
msec = (now_tv.tv_sec - start_tv.tv_sec) * 1000L 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) if (msec > 2000)
{ {
noread_cnt = 5; noread_cnt = 5;
@@ -4864,10 +4865,15 @@ mch_call_shell(
# endif # endif
} }
/* If we already detected the child has finished break the /* If we already detected the child has finished, continue
* loop now. */ * reading output for a short while. Some text may be
* buffered. */
if (wait_pid == pid) if (wait_pid == pid)
{
if (noread_cnt < 5)
continue;
break; break;
}
/* /*
* Check if the child still exists, before checking for * Check if the child still exists, before checking for

View File

@@ -748,6 +748,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1710,
/**/ /**/
1709, 1709,
/**/ /**/