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
  • 11,491
  • 17
  • 68
  • 126

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,554
  • 2
  • 37
  • 62