Skip to content

Commit

Permalink
cleanly interrupt server when we get SIGTERM
Browse files Browse the repository at this point in the history
  • Loading branch information
rfk committed Jan 27, 2011
1 parent 4db2b66 commit a46a4b1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion m2wsgi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,9 @@ def main(argv=None):
iomod.monkey_patch()
# Try hard to clean up properly when killed
if signal is not None:
signal.signal(signal.SIGTERM,lambda *a: sys.exit(1))
def interrupt():
raise KeyboardInterrupt
signal.signal(signal.SIGTERM,lambda *a: interrupt)
# Start the requested N handler threads.
# N-1 are started in background threads, then one on this thread.
handlers = []
Expand Down

0 comments on commit a46a4b1

Please sign in to comment.