[GRASS-SVN] r73338 - grass/trunk/lib/init

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Sep 15 19:45:09 PDT 2018


Author: wenzeslaus
Date: 2018-09-15 19:45:09 -0700 (Sat, 15 Sep 2018)
New Revision: 73338

Modified:
   grass/trunk/lib/init/grass.py
Log:
init: call clean_temp always at exit

This is has the same behaviour as before, i.e. clean_temp called at all exits
and it is similar to what was there before r73336, i.e. .tmp deleted at exit.
Additionally this calls clean_temp also in some error states when then
exist function calls in the call are not reached.

See #3635 for removal of Python-based clean up procedures (which should be covered by clean_temp).


Modified: grass/trunk/lib/init/grass.py
===================================================================
--- grass/trunk/lib/init/grass.py	2018-09-16 02:22:14 UTC (rev 73337)
+++ grass/trunk/lib/init/grass.py	2018-09-16 02:45:09 UTC (rev 73338)
@@ -2142,6 +2142,9 @@
     # unlock the mapset which is current at the time of turning off
     # in case mapset was changed
     atexit.register(lambda: unlock_gisrc_mapset(gisrc, gisrcrc))
+    # clean always at exit, cleans whatever is current mapset based on
+    # the GISRC env variable
+    atexit.register(clean_temp)
 
     # build user fontcap if specified but not present
     make_fontcap()
@@ -2153,10 +2156,8 @@
     # only non-error, interactive version continues from here
     if batch_job:
         returncode = run_batch_job(batch_job)
-        clean_temp()
         sys.exit(returncode)
     elif params.exit_grass:
-        clean_temp()
         sys.exit(0)
     else:
         clear_screen()
@@ -2193,9 +2194,6 @@
         close_gui()
         # here we are at the end of grass session
         clear_screen()
-        # TODO: can we just register this atexit?
-        # TODO: and what is difference to deleting .tmp which we do?
-        clean_temp()
         # save 'last used' GISRC after removing variables which shouldn't
         # be saved, e.g. d.mon related
         clean_env(gisrc)



More information about the grass-commit mailing list