Created
September 5, 2016 15:01
-
-
Save mattn/214b61186e2fe091fa65e2b6fbaa8069 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 bbe98be..4777b35 100644 | |
--- a/src/channel.c | |
+++ b/src/channel.c | |
@@ -2892,17 +2892,21 @@ 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) { | |
+ if (GetLastError() != ERROR_BROKEN_PIPE) | |
+ return CW_NOT_READY; | |
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