properly catch SIGTERM

Oscar Benjamin oscar.benjamin at bristol.ac.uk
Fri Jul 20 13:18:52 EDT 2012


What about Kushal's suggestion above? Does the following work for you?

signal.signal(signal.SIGTERM, my_SIGTERM_handler)
signal.siginterrupt(signal.SIGTERM, flag=False)

According to the siginterrupt docs (
http://docs.python.org/library/signal.html)
"""
Change system call restart behaviour: if flag is False, system calls will
be restarted when interrupted by signal signalnum, otherwise system calls
will be interrupted. Returns nothing. Availability: Unix
'"""

Cheers,
Oscar.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120720/8ac66899/attachment.html>


More information about the Python-list mailing list