diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-02-04 22:09:48 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-02-04 22:09:48 +0100 |
commit | a8343c1808f2f268282f3030ce4adaf22e8ade54 (patch) | |
tree | cf853bc590793f2dd2bec4b62ff08f9efa30c80a | |
parent | 3fc3e14282c182c046d1335f3d576bc0eeb605c5 (diff) | |
download | vim-git-a8343c1808f2f268282f3030ce4adaf22e8ade54.tar.gz |
patch 7.4.1260v7.4.1260
Problem: The channel feature doesn't work on Win32 GUI.
Solution: Use WSAGetLastError(). (Ken Takata)
-rw-r--r-- | src/channel.c | 13 | ||||
-rw-r--r-- | src/testdir/test_channel.vim | 4 | ||||
-rw-r--r-- | src/version.c | 2 | ||||
-rw-r--r-- | src/vim.h | 2 |
4 files changed, 17 insertions, 4 deletions
diff --git a/src/channel.c b/src/channel.c index b9a2a972f..129017194 100644 --- a/src/channel.c +++ b/src/channel.c @@ -954,11 +954,12 @@ channel_clear(int idx) /* * Check for reading from "fd" with "timeout" msec. * Return FAIL when there is nothing to read. + * Always returns OK for FEAT_GUI_W32. */ static int channel_wait(int fd, int timeout) { -#ifdef HAVE_SELECT +#if defined(HAVE_SELECT) && !defined(FEAT_GUI_W32) struct timeval tval; fd_set rfds; int ret; @@ -1045,6 +1046,16 @@ channel_read(int idx) if (len < MAXMSGSIZE) break; /* did read everything that's available */ } +#ifdef FEAT_GUI_W32 + if (len == SOCKET_ERROR) + { + /* For Win32 GUI channel_wait() always returns OK and we handle the + * situation that there is nothing to read here. + * TODO: how about a timeout? */ + if (WSAGetLastError() == WSAEWOULDBLOCK) + return; + } +#endif /* Reading a socket disconnection (readlen == 0), or a socket error. */ if (readlen <= 0) diff --git a/src/testdir/test_channel.vim b/src/testdir/test_channel.vim index f4c8e575b..a81996153 100644 --- a/src/testdir/test_channel.vim +++ b/src/testdir/test_channel.vim @@ -6,13 +6,13 @@ if !has('channel') endif " This test requires the Python command to run the test server. -" This most likely only works on Unix and Windows console. +" This most likely only works on Unix and Windows. if has('unix') " We also need the pkill command to make sure the server can be stopped. if !executable('python') || !executable('pkill') finish endif -elseif has('win32') && !has('gui_win32') +elseif has('win32') " Use Python Launcher for Windows (py.exe). if !executable('py') finish diff --git a/src/version.c b/src/version.c index 634b97c23..8611d49c1 100644 --- a/src/version.c +++ b/src/version.c @@ -743,6 +743,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1260, +/**/ 1259, /**/ 1258, @@ -519,7 +519,7 @@ typedef unsigned long u8char_T; /* long should be 32 bits or more */ # ifdef HAVE_SYS_POLL_H # include <sys/poll.h> # define HAVE_POLL -# elif defined(WIN32) && !defined(FEAT_GUI_W32) +# elif defined(WIN32) # define HAVE_SELECT # else # ifdef HAVE_POLL_H |