commands: Explicitely close the Queue object.

This commit is contained in:
Valentin Lorentz 2014-08-14 14:18:47 +02:00
parent bd1ac36c2c
commit 60a65b831e
1 changed files with 3 additions and 0 deletions

View File

@ -121,11 +121,14 @@ def process(f, *args, **kwargs):
p.join(timeout)
if p.is_alive():
p.terminate()
q.close()
raise ProcessTimeoutError("%s aborted due to timeout." % (p.name,))
try:
v = q.get(block=False)
except Queue.Empty:
return None
finally:
q.close()
if isinstance(v, Exception):
raise v
else: