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

View File

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