Hi,

In an addon, I define an atexit procedure, that removes all temporary data that 
has a prefix defined by a global variable "TMPNAME".

This works nicely when I run the addon from the command line. Regardless if the 
module ends with or without success, all temporary data is cleaned up at the 
end properly.
However, when I run it through the GUI the cleanup method does not remove the 
temporary maps when the process fails or is aborted by the user...

Looking into the GUI code, it seems that if one presses the "Stop" button, the 
process is aborted with Popen().terminate(). That does not trigger the "atexit" 
function and additional signals would have to be caught, like e.g. here:
https://stackoverflow.com/questions/23468042/the-invocation-of-signal-handler-and-atexit-handler-in-python

What would be the proper way to address this? Adding a signal handler in 
addons? I did not see any way to terminate running modules from the GUI 
differently?
Would it be possible to add signal handling as a library function?

Cheers
Stefan


_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Reply via email to