fixing decode in python3

This commit is contained in:
yeger 2019-01-11 14:00:40 -05:00
parent 83b615c060
commit 07c6b40f8b
2 changed files with 5 additions and 5 deletions

View File

@ -9,10 +9,10 @@ class ReadPipe(threading.Thread):
self.pipe = pipe
def run(self):
line = self.pipe.readline()
line = self.pipe.readline().decode('utf-8')
while line:
print(line)
line = self.pipe.readline()
line = self.pipe.readline().decode('utf-8')
if __name__ == "__main__":
clangd_path = "/usr/bin/clangd-6.0"

View File

@ -62,7 +62,7 @@ class JsonRpcEndpoint(object):
line = self.stdout.readline()
if not line:
return None
line = line.decode()
line = line.decode('utf-8')
# TODO: handle content type as well.
match = re.match(JSON_RPC_RES_REGEX, line)
if match is None or not match.groups():
@ -71,8 +71,8 @@ class JsonRpcEndpoint(object):
line = self.stdout.readline()
if not line:
return None
line = line.decode()
line = line.decode('utf-8')
if line != "\r\n":
raise RuntimeError("Bad header: missing newline")
jsonrpc_res = self.stdout.read(size)
jsonrpc_res = self.stdout.read(size).decode('utf-8')
return json.loads(jsonrpc_res)