Reputation: 23686
I have a python script which makes use of multiprocessing. I like to debug my scripts in Eclipse, but with multiprocessing, I always have to manually kill the spawned children processes after termination. How can I catch the Eclipse termination action in the script so it can clean up?
Upvotes: 4
Views: 2288
Reputation: 166
By catching the eclipse termination, do you mean catching the event of someone pressing the "Terminate" button while debugging? If so, I don't think there is an exception or event you can catch.
Here is a few things i tried on the side that does not work either: 1. Adding signal handlers for SIGTERM, SIGNTEAL, and SIGINT, but no luck. 2. try the atexit module, it only works only normal program termination.
Upvotes: 3