mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-25 19:44:13 +01:00
only raise in commands.process() when a raise was wrapped (#1370)
This commit is contained in:
parent
219ac6d154
commit
6c5072cfe0
@ -123,9 +123,9 @@ def process(f, *args, **kwargs):
|
|||||||
resource.setrlimit(rsrc, (soft, hard))
|
resource.setrlimit(rsrc, (soft, hard))
|
||||||
try:
|
try:
|
||||||
r = f(*args, **kwargs)
|
r = f(*args, **kwargs)
|
||||||
q.put(r)
|
q.put([False, r])
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
q.put(e)
|
q.put([True, e])
|
||||||
targetArgs = (f, q,) + args
|
targetArgs = (f, q,) + args
|
||||||
p = callbacks.CommandProcess(target=newf,
|
p = callbacks.CommandProcess(target=newf,
|
||||||
args=targetArgs, kwargs=kwargs)
|
args=targetArgs, kwargs=kwargs)
|
||||||
@ -136,12 +136,13 @@ def process(f, *args, **kwargs):
|
|||||||
q.close()
|
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)
|
raised, v = q.get(block=False)
|
||||||
except minisix.queue.Empty:
|
except minisix.queue.Empty:
|
||||||
return None
|
return None
|
||||||
finally:
|
finally:
|
||||||
q.close()
|
q.close()
|
||||||
if isinstance(v, Exception):
|
|
||||||
|
if raised:
|
||||||
raise v
|
raise v
|
||||||
else:
|
else:
|
||||||
return v
|
return v
|
||||||
|
Loading…
Reference in New Issue
Block a user