Commit 658df807 authored by Jérome Perrin's avatar Jérome Perrin

fix signal handler for timeout

parent acc74036
...@@ -121,7 +121,12 @@ def _runWithTimeout(queue, func, args, kw): ...@@ -121,7 +121,12 @@ def _runWithTimeout(queue, func, args, kw):
signal.signal(signal.SIGUSR1, lambda sig, stack: traceback.print_stack(stack)) signal.signal(signal.SIGUSR1, lambda sig, stack: traceback.print_stack(stack))
print "To see current traceback:" print "To see current traceback:"
print " kill -SIGUSR1 %s" % os.getpid() print " kill -SIGUSR1 %s" % os.getpid()
signal.signal(signal.SIGTERM, lambda sig, stack: traceback.print_stack(stack))
# print a traceback when terminated.
def handler(sig, stack):
traceback.print_stack(stack)
sys.exit(0)
signal.signal(signal.SIGTERM, handler)
queue.put(func(*args, **kw)) queue.put(func(*args, **kw))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment