[GRASS-SVN] r73733 - grass/branches/releasebranch_7_6/lib/init

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Nov 30 04:01:04 PST 2018


Author: neteler
Date: 2018-11-30 04:01:04 -0800 (Fri, 30 Nov 2018)
New Revision: 73733

Modified:
   grass/branches/releasebranch_7_6/lib/init/grass.py
Log:
init: Do not fail if directory exists (observed in a case of race condition) (trunk, r73519)

Modified: grass/branches/releasebranch_7_6/lib/init/grass.py
===================================================================
--- grass/branches/releasebranch_7_6/lib/init/grass.py	2018-11-30 11:56:29 UTC (rev 73732)
+++ grass/branches/releasebranch_7_6/lib/init/grass.py	2018-11-30 12:01:04 UTC (rev 73733)
@@ -402,7 +402,14 @@
         grass_config_dirname = ".grass7"
         directory = os.path.join(os.getenv('HOME'), grass_config_dirname)
     if not os.path.exists(directory):
-        os.mkdir(directory)
+        try:
+            os.mkdir(directory)
+        except OSError as e:
+            # Can happen as a race condition
+            if not e.errno == 17:
+                fatal(
+                    _("Failed to create configuration directory '%s' with error: %s")
+                    % (directory, e.strerror))
     return directory
 
 



More information about the grass-commit mailing list