]> granicus.if.org Git - vim/commitdiff
patch 7.4.1260 v7.4.1260
authorBram Moolenaar <Bram@vim.org>
Thu, 4 Feb 2016 21:09:48 +0000 (22:09 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 4 Feb 2016 21:09:48 +0000 (22:09 +0100)
Problem:    The channel feature doesn't work on Win32 GUI.
Solution:   Use WSAGetLastError(). (Ken Takata)

src/channel.c
src/testdir/test_channel.vim
src/version.c
src/vim.h

index b9a2a972fa3fe22614e579b57fcc99bcc95d8440..1290171949bb841f7e9b5006586d88f2528fdc74 100644 (file)
@@ -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)
index f4c8e575b4099aaa23f281c23587f8a6a811522a..a819961536c34151cb71c9d443b6ae9025dde5fb 100644 (file)
@@ -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
index 634b97c239c2044f2350e641b82c0c19e18024a3..8611d49c18f5de1e09fe772677bb6a8514dc797b 100644 (file)
@@ -742,6 +742,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1260,
 /**/
     1259,
 /**/
index 18610f5c442b8bd3d7a89c4bf35a73a64756444d..02f30363712063731044d5779ec2fdefa3ce5ecf 100644 (file)
--- a/src/vim.h
+++ b/src/vim.h
@@ -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