[GRASS-dev] Python scripts: trigger cleanup function at keyboard interrupt (CTRL-C)
Markus Neteler
neteler at osgeo.org
Mon Oct 14 07:00:00 PDT 2019
Hi,
in the GRASS GIS 6 shell scripts we used this code to clean up temp
files upon CTRL-C signal:
cleanup()
{
g.message -v "Cleaning up ..."
cd "$MSET_DIR"
rm -rf "$TMP_DIR"
}
#### trap ctrl-c so that we can clean up tmp
trap 'cleanup' 2 3 15
If there anything similar we could add to the python scripts?
thanks
Markus
More information about the grass-dev
mailing list