Fix vscode tests for python3

encode/decode the data before sending it over the socket. Since (AFAICT)
the vscode protocol (unlike the gdb-remote one) is fully textual, using
the utf8 codec here is appropriate.

llvm-svn: 354308
This commit is contained in:
Pavel Labath 2019-02-19 08:25:25 +00:00
parent eebf32fad6
commit 499611a20f
1 changed files with 2 additions and 2 deletions

View File

@ -54,7 +54,7 @@ def read_packet(f, verbose=False, trace_file=None):
'''Decode a JSON packet that starts with the content length and is
followed by the JSON bytes from a file 'f'
'''
line = f.readline()
line = f.readline().decode("utf-8")
if len(line) == 0:
return None
@ -121,7 +121,7 @@ class DebugCommunication(object):
@classmethod
def encode_content(cls, s):
return "Content-Length: %u\r\n\r\n%s" % (len(s), s)
return ("Content-Length: %u\r\n\r\n%s" % (len(s), s)).encode("utf-8")
@classmethod
def validate_response(cls, command, response):