wakepy
wakepy copied to clipboard
Cleanup on SIGTERM, SIGHUP, SIGQUIT
Background: The kill signals, from weakest to strongest are:
- 2: SIGINT (Ctrl-C). This creates KeyboardInterrupt Exception in python and is handled already
- 15: SIGTERM. The "clean exit" signal, but it requires the application to handle it.
- 1: SIGHUP: Also "clean exit". Requires application to handle it.
- 3: SIGQUIT. May be handled, too.
- 9 SIGKILL: Cannot be catched or handled. Just kills the program.
As wakepy catches exceptions, the SIGINT is already handled. The SIGTERM, SIGHUP and SIGQUIT could be handled. The only thing what wakepy should do on these is to deactivate the active wakepy.Mode.
This is not very urgent as all the currently (wakepy 0.8.0 dev) used methods have zero effect if the process using wakepy suddenly dies. But in the future, if there would be some method that changes some global configuration, this would be required. Although I do not think methods changing global configuration are good idea, sometimes they might be necessary.