fixing decode in python3
This commit is contained in:
parent
83b615c060
commit
07c6b40f8b
@ -9,10 +9,10 @@ class ReadPipe(threading.Thread):
|
|||||||
self.pipe = pipe
|
self.pipe = pipe
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
line = self.pipe.readline()
|
line = self.pipe.readline().decode('utf-8')
|
||||||
while line:
|
while line:
|
||||||
print(line)
|
print(line)
|
||||||
line = self.pipe.readline()
|
line = self.pipe.readline().decode('utf-8')
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
clangd_path = "/usr/bin/clangd-6.0"
|
clangd_path = "/usr/bin/clangd-6.0"
|
||||||
|
@ -62,7 +62,7 @@ class JsonRpcEndpoint(object):
|
|||||||
line = self.stdout.readline()
|
line = self.stdout.readline()
|
||||||
if not line:
|
if not line:
|
||||||
return None
|
return None
|
||||||
line = line.decode()
|
line = line.decode('utf-8')
|
||||||
# TODO: handle content type as well.
|
# TODO: handle content type as well.
|
||||||
match = re.match(JSON_RPC_RES_REGEX, line)
|
match = re.match(JSON_RPC_RES_REGEX, line)
|
||||||
if match is None or not match.groups():
|
if match is None or not match.groups():
|
||||||
@ -71,8 +71,8 @@ class JsonRpcEndpoint(object):
|
|||||||
line = self.stdout.readline()
|
line = self.stdout.readline()
|
||||||
if not line:
|
if not line:
|
||||||
return None
|
return None
|
||||||
line = line.decode()
|
line = line.decode('utf-8')
|
||||||
if line != "\r\n":
|
if line != "\r\n":
|
||||||
raise RuntimeError("Bad header: missing newline")
|
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)
|
return json.loads(jsonrpc_res)
|
||||||
|
Loading…
Reference in New Issue
Block a user