diff src/testdir/test_channel.py @ 7914:35973ce58c84 v7.4.1253

commit https://github.com/vim/vim/commit/608a8919cae982cb38e38725a843df47b234dae6 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Feb 3 22:39:51 2016 +0100 patch 7.4.1253 Problem: Python test server not displaying second of two commands. Solaris doesn't have "pkill --full". Solution: Also echo the second command. Use "pkill -f".
author Christian Brabandt <cb@256bit.org>
date Wed, 03 Feb 2016 22:45:04 +0100
parents 1c6ef9113556
children 54602dcac207
line wrap: on
line diff
--- a/src/testdir/test_channel.py
+++ b/src/testdir/test_channel.py
@@ -34,32 +34,34 @@ class ThreadedTCPRequestHandler(socketse
         thesocket = self.request
         while True:
             try:
-                data = self.request.recv(4096).decode('utf-8')
+                received = self.request.recv(4096).decode('utf-8')
             except socket.error:
                 print("=== socket error ===")
                 break
             except IOError:
                 print("=== socket closed ===")
                 break
-            if data == '':
+            if received == '':
                 print("=== socket closed ===")
                 break
-            print("received: {}".format(data))
+            print("received: {}".format(received))
 
             # We may receive two messages at once. Take the part up to the
             # matching "]" (recognized by finding "][").
-            while data != '':
-                splitidx = data.find('][')
+            todo = received
+            while todo != '':
+                splitidx = todo.find('][')
                 if splitidx < 0:
-                     todo = data
-                     data = ''
+                     used = todo
+                     todo = ''
                 else:
-                     todo = data[:splitidx + 1]
-                     data = data[splitidx + 1:]
-                     print("using: {}".format(todo))
+                     used = todo[:splitidx + 1]
+                     todo = todo[splitidx + 1:]
+                if used != received:
+                    print("using: {}".format(used))
 
                 try:
-                    decoded = json.loads(todo)
+                    decoded = json.loads(used)
                 except ValueError:
                     print("json decoding failed")
                     decoded = [-1, '']