diff src/os_mswin.c @ 11187:515db00c4676 v8.0.0480

patch 8.0.0480: the remote_peek() test fails on MS-Windows commit https://github.com/vim/vim/commit/15e737f768542fcc516296b5c158e14cc7ba7feb Author: Bram Moolenaar <Bram@vim.org> Date: Sat Mar 18 21:22:47 2017 +0100 patch 8.0.0480: the remote_peek() test fails on MS-Windows Problem: The remote_peek() test fails on MS-Windows. Solution: Check for pending messages. Also report errors in the first run if a flaky test fails twice.
author Christian Brabandt <cb@256bit.org>
date Sat, 18 Mar 2017 21:30:04 +0100
parents 13544aa85dc0
children 71311d899b42
line wrap: on
line diff
--- a/src/os_mswin.c
+++ b/src/os_mswin.c
@@ -2526,6 +2526,7 @@ serverGetReply(HWND server, int *expr_re
     int		i;
     char_u	*reply;
     reply_T	*rep;
+    int		did_process = FALSE;
 
     /* When waiting, loop until the message waiting for is received. */
     for (;;)
@@ -2562,7 +2563,17 @@ serverGetReply(HWND server, int *expr_re
 	/* If we got here, we didn't find a reply. Return immediately if the
 	 * "wait" parameter isn't set.  */
 	if (!wait)
+	{
+	    /* Process pending messages once. Without this, looping on
+	     * remote_peek() would never get the reply. */
+	    if (!did_process)
+	    {
+		did_process = TRUE;
+		serverProcessPendingMessages();
+		continue;
+	    }
 	    break;
+	}
 
 	/* We need to wait for a reply. Enter a message loop until the
 	 * "reply_received" flag gets set. */