Operate on a byte level instead of utf8 strings only

This commit is contained in:
Kristóf Tóth
2019-04-01 14:27:37 +02:00
parent 3a2ccc1ea4
commit 07c35cc8bf
2 changed files with 7 additions and 7 deletions

View File

@ -17,13 +17,13 @@ class PipeWriterThread(Thread):
@terminate_process_on_failure
def run(self):
try:
with open(self._pipe_path, 'w') as pipe:
with open(self._pipe_path, 'wb') as pipe:
while True:
message = self._write_queue.get(block=True)
if message is None:
self._stop_event.set()
break
pipe.write(f'{message}\n')
pipe.write(message + b'\n')
pipe.flush()
except BrokenPipeError:
self._stop_event.set()
@ -34,4 +34,4 @@ class PipeWriterThread(Thread):
def unblock(self):
self._write_queue.put(None)
open(self._pipe_path, 'r').close()
open(self._pipe_path, 'rb').close()