Do a proper close on SIGINT and SIGTERM
This commit is contained in:
parent
7bc37617b0
commit
ec512fc540
|
@ -16,6 +16,7 @@
|
|||
|
||||
def main():
|
||||
import os
|
||||
import signal
|
||||
import sys
|
||||
|
||||
# Parse command line arguments
|
||||
|
@ -153,6 +154,12 @@ def main():
|
|||
for module in args.module:
|
||||
__import__(module)
|
||||
|
||||
# Signals handling
|
||||
def sighandler(signum, frame):
|
||||
context.quit()
|
||||
signal.signal(signal.SIGINT, sighandler)
|
||||
signal.signal(signal.SIGTERM, sighandler)
|
||||
|
||||
context.start()
|
||||
context.join()
|
||||
|
||||
|
|
Loading…
Reference in New Issue