Created
September 5, 2016 05:57
-
-
Save mattn/80bbdb9d27b62e0f37c86f8f2e112b34 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/channel.c b/src/channel.c | |
index 10ed42e..c465be7 100644 | |
--- a/src/channel.c | |
+++ b/src/channel.c | |
@@ -2888,17 +2888,18 @@ channel_wait(channel_T *channel, sock_T fd, int timeout) | |
DWORD nread; | |
int sleep_time; | |
DWORD deadline = GetTickCount() + timeout; | |
- int delay = 1; | |
+ int r, delay = 1; | |
/* reading from a pipe, not a socket */ | |
while (TRUE) | |
{ | |
- int r = PeekNamedPipe((HANDLE)fd, NULL, 0, NULL, &nread, NULL); | |
+ nread = 0; | |
+ r = PeekNamedPipe((HANDLE)fd, NULL, 0, NULL, &nread, NULL); | |
- if (r && nread > 0) | |
- return CW_READY; | |
- if (r == 0) | |
+ if (r == 0 && GetLastError() != ERROR_BROKEN_PIPE) | |
return CW_ERROR; | |
+ if (nread > 0) | |
+ return CW_READY; | |
/* perhaps write some buffer lines */ | |
channel_write_any_lines(); | |
diff --git a/src/testdir/shared.vim b/src/testdir/shared.vim | |
index 24b05be..cdf4c53 100644 | |
--- a/src/testdir/shared.vim | |
+++ b/src/testdir/shared.vim | |
@@ -121,10 +121,10 @@ func WaitFor(expr) | |
for i in range(100) | |
try | |
if eval(a:expr) | |
- if has('reltime') | |
- return float2nr(reltimefloat(reltime(start)) * 1000) | |
- endif | |
- return slept | |
+ if has('reltime') | |
+ return float2nr(reltimefloat(reltime(start)) * 1000) | |
+ endif | |
+ return slept | |
endif | |
catch | |
endtry |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment