Close event passed to python script when canceling toolbox script

Discussion created by odonnellm on Apr 11, 2012
Latest reply on Apr 11, 2012 by curtvprice
I have written a program that spawns jobs and I would like to kill these jobs when the native python script (invoked from toolbox) is canceled from the results tab of ArcMap or ArcCatalog. First, I am unclear as to what type of signal is passed to the script that enables ESRI to terminate it, and second I am not sure how to detect the event and then run a clean up based on this signal. Has anyone tried this before. There was a post on ESRI a couple years ago but no one figured it out and therefore there was no posted resolution.

I believe I might be able to use win32api, but I have not figured it out yet. For example:
win32api.SetConsoleCtrlHandler(func, True)