Should stdlib provide something to properly handle SIGINT/SIGTERM signals?
Since this is a problem which occurs very often, I'd like to hear your opinion as to whether something like this might find some place in the python stdlib (signal module maybe?). Please read the discussion included in this recipe: http://code.activestate.com/recipes/577997/ It should provide a description of the problem and the general use case. Thanks in advance for your comments, --- Giampaolo http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/
On 12/27/2011 12:57 PM, Giampaolo Rodolà wrote:
Since this is a problem which occurs very often, I'd like to hear your opinion as to whether something like this might find some place in the python stdlib (signal module maybe?). Please read the discussion included in this recipe: http://code.activestate.com/recipes/577997/ It should provide a description of the problem and the general use case.
It seems to me that your problem is this "From http://docs.python.org/library/atexit.html: the functions registered via this module are not called when the program is killed by a signal not handled by Python " So it seems to me that the solution should be an option to change that, or rather, change the handling of exit signals. -- Terry Jan Reedy
Giampaolo Rodolà wrote:
The behavior I would expect when facing such a problem is the following:
* I want my exit function to always be called, no matter what o I'm aware that it won't be called in case of SIGKILL or os._exit() though * I do not want to override previously registered signal handlers (if any) o Instead I want the old handler to be called fist and my exit function to be called last
Aren't nested handlers usually called in a last-in/first-out manner? ~Ethan~
participants (3)
-
Ethan Furman
-
Giampaolo Rodolà
-
Terry Reedy