Fix exception leaving app in IO block (use non-blocing IO to teardown writer)

This commit is contained in:
Kristóf Tóth 2019-04-01 14:36:11 +02:00
parent 07c35cc8bf
commit a3d2ea37d5

View File

@ -1,5 +1,8 @@
from threading import Thread
from contextlib import suppress
from os import O_NONBLOCK, O_RDONLY, close
from os import open as osopen
from queue import Queue
from threading import Thread
from .terminate_process_on_failure import terminate_process_on_failure
@ -34,4 +37,6 @@ class PipeWriterThread(Thread):
def unblock(self):
self._write_queue.put(None)
open(self._pipe_path, 'rb').close()
with suppress(OSError):
fd = osopen(self._pipe_path, O_RDONLY | O_NONBLOCK)
close(fd)