Do a proper close on SIGINT and SIGTERM
This commit is contained in:
parent
93f7061e08
commit
3ecab04f19
1 changed files with 7 additions and 0 deletions
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
import os
|
import os
|
||||||
|
import signal
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
# Parse command line arguments
|
# Parse command line arguments
|
||||||
|
|
@ -155,6 +156,12 @@ def main():
|
||||||
for module in args.module:
|
for module in args.module:
|
||||||
__import__(module)
|
__import__(module)
|
||||||
|
|
||||||
|
# Signals handling
|
||||||
|
def sighandler(signum, frame):
|
||||||
|
context.quit()
|
||||||
|
signal.signal(signal.SIGINT, sighandler)
|
||||||
|
signal.signal(signal.SIGTERM, sighandler)
|
||||||
|
|
||||||
context.start()
|
context.start()
|
||||||
context.join()
|
context.join()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue