fixing decode in python3
This commit is contained in:
parent
83b615c060
commit
07c6b40f8b
@ -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"
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user