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

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Sep 4 20:14:12 PDT 2018


Author: wenzeslaus
Date: 2018-09-04 20:14:12 -0700 (Tue, 04 Sep 2018)
New Revision: 73261

Modified:
   grass/trunk/lib/init/grass.py
Log:
init: support spaces in path for GRASS_BATCH_JOB (see #3170)

Modified: grass/trunk/lib/init/grass.py
===================================================================
--- grass/trunk/lib/init/grass.py	2018-09-05 02:24:38 UTC (rev 73260)
+++ grass/trunk/lib/init/grass.py	2018-09-05 03:14:12 UTC (rev 73261)
@@ -1549,9 +1549,17 @@
     """
     batch_job_string = batch_job
     if not isinstance(batch_job, string_types):
+        # for messages only
         batch_job_string = ' '.join(batch_job)
     message(_("Executing <%s> ...") % batch_job_string)
     if isinstance(batch_job, string_types):
+        # shell=True is keeping the original GRASS_BATCH_JOB behavior
+        def quote(string):
+            if '"' in string:
+                return "'%s'" % batch_job
+            else:
+                return '"%s"' % batch_job
+        batch_job = quote(batch_job)
         proc = Popen(batch_job, shell=True)
     else:
         try:



More information about the grass-commit mailing list