2

From reading documentation and other questions here, I see different examples for how to execute functions on SIGINT, SIGTERM, on calls to sys.exit(), etc.

Is there any way to register a function to run on any kind of termination? "any kind" means:

  1. Regular exit using sys.exit() or when the flow ends
  2. An uncaught error that crashes the application
  3. External various killing signals
SomethingSomething
  • 10,344
  • 14
  • 61
  • 112

1 Answers1

0

This is not generically possible. E.g. for SIGKILL, you user program has no control. The operating system will simply terminate it. Cf. SIGKILL signal handling or SIGKILL signal Handler

languitar
  • 6,226
  • 2
  • 36
  • 59