move _raise_deadline() out of except block to clean up printed stacktrace

This commit is contained in:
jesopo 2019-09-18 10:21:40 +01:00
parent ea1698499f
commit dce6eee8c9

View file

@ -398,10 +398,14 @@ def deadline_process(func: typing.Callable[[], None], seconds: int=10):
p = multiprocessing.Process(target=_wrap, args=(func, q))
p.start()
deadlined = False
try:
success, out = q.get(block=True, timeout=seconds)
except queue.Empty:
p.kill()
deadlined = True
if deadlined:
_raise_deadline()
if success: