From 31faed60bfd54ff8f612f6b311a6cbcd9e7ebedd Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 22 Jan 2019 23:01:40 +0100 Subject: [PATCH] patch 8.1.0796: MS-Windows 7: problem with named pipe on channel Problem: MS-Windows 7: problem with named pipe on channel. Solution: Put back the disconnect/connect calls. (Yasuhiro Matsumoto, closes #3833) --- src/channel.c | 17 ++++++++++++++++- src/testdir/test_terminal.vim | 3 +-- src/version.c | 2 ++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/channel.c b/src/channel.c index 41d19f51e..3a80748a1 100644 --- a/src/channel.c +++ b/src/channel.c @@ -3181,7 +3181,13 @@ channel_wait(channel_T *channel, sock_T fd, int timeout) if (r && nread > 0) return CW_READY; - if (r == 0) + + if (channel->ch_named_pipe) + { + DisconnectNamedPipe((HANDLE)fd); + ConnectNamedPipe((HANDLE)fd, NULL); + } + else if (r == 0) return CW_ERROR; /* perhaps write some buffer lines */ @@ -3813,7 +3819,16 @@ channel_send( if (part == PART_SOCK) res = sock_write(fd, (char *)buf, len); else + { res = fd_write(fd, (char *)buf, len); +#ifdef WIN32 + if (channel->ch_named_pipe && res < 0) + { + DisconnectNamedPipe((HANDLE)fd); + ConnectNamedPipe((HANDLE)fd, NULL); + } +#endif + } if (res < 0 && (errno == EWOULDBLOCK #ifdef EAGAIN || errno == EAGAIN diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim index 960a85e97..ea7d4b1b6 100644 --- a/src/testdir/test_terminal.vim +++ b/src/testdir/test_terminal.vim @@ -644,8 +644,7 @@ endfunc func Test_terminal_no_cmd() " Does not work on Mac. - " Todo: make this work on Win32 again - if has('mac') || has('win32') + if has('mac') return endif let buf = term_start('NONE', {}) diff --git a/src/version.c b/src/version.c index 91b354262..a4decba70 100644 --- a/src/version.c +++ b/src/version.c @@ -791,6 +791,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 796, /**/ 795, /**/ -- 2.50.1