summaryrefslogtreecommitdiffstats
path: root/Tests/Server
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-10-24 14:44:44 (GMT)
committerBrad King <brad.king@kitware.com>2016-10-24 18:36:13 (GMT)
commit9b8dc79cc84d12c1e661ca3cd77b773b463508d7 (patch)
treea0db36834af7c2c137beec99271965cb0ab5bc77 /Tests/Server
parent48189697eb2ac97407cf4ffc0d2f3e600f3cd6ac (diff)
downloadCMake-9b8dc79cc84d12c1e661ca3cd77b773b463508d7.zip
CMake-9b8dc79cc84d12c1e661ca3cd77b773b463508d7.tar.gz
CMake-9b8dc79cc84d12c1e661ca3cd77b773b463508d7.tar.bz2
cmake-server: Change message wrapper to avoid ambiguity with content
Change our message wrapper from [== CMake Server ==[ ... ]== CMake Server ==] to [== "CMake Server" ==[ ... ]== "CMake Server" ==] to guarantee that no JSON content can ever contain the ending string (because it would be encoded as `]== \"CMake Server\" ==]`).
Diffstat (limited to 'Tests/Server')
-rw-r--r--Tests/Server/cmakelib.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/Tests/Server/cmakelib.py b/Tests/Server/cmakelib.py
index 94384eb..d11431d 100644
--- a/Tests/Server/cmakelib.py
+++ b/Tests/Server/cmakelib.py
@@ -46,11 +46,11 @@ def waitForRawMessage(cmakeCommand):
stdoutdata += stdoutdataLine.decode('utf-8')
else:
break
- begin = stdoutdata.find("[== CMake Server ==[\n")
- end = stdoutdata.find("]== CMake Server ==]")
+ begin = stdoutdata.find('[== "CMake Server" ==[\n')
+ end = stdoutdata.find(']== "CMake Server" ==]')
if (begin != -1 and end != -1):
- begin += len("[== CMake Server ==[\n")
+ begin += len('[== "CMake Server" ==[\n')
payload = stdoutdata[begin:end]
if print_communication:
print("\nSERVER>", json.loads(payload), "\n")
@@ -59,9 +59,9 @@ def waitForRawMessage(cmakeCommand):
def writeRawData(cmakeCommand, content):
writeRawData.counter += 1
payload = """
-[== CMake Server ==[
+[== "CMake Server" ==[
%s
-]== CMake Server ==]
+]== "CMake Server" ==]
""" % content
rn = ( writeRawData.counter % 2 ) == 0