[GRASS-SVN] r41395 -
	grass/branches/releasebranch_6_4/gui/wxpython/gui_modules
    svn_grass at osgeo.org 
    svn_grass at osgeo.org
       
    Fri Mar 12 08:10:40 EST 2010
    
    
  
Author: martinl
Date: 2010-03-12 08:10:40 -0500 (Fri, 12 Mar 2010)
New Revision: 41395
Modified:
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gcmd.py
Log:
encode command strings only on windows, see r41390
Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gcmd.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gcmd.py	2010-03-12 12:54:51 UTC (rev 41394)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gcmd.py	2010-03-12 13:10:40 UTC (rev 41395)
@@ -129,6 +129,18 @@
 
 class Popen(subprocess.Popen):
     """Subclass subprocess.Popen"""
+    def __init__(self, *args, **kwargs):
+        if subprocess.mswindows:
+            try:
+                kwargs['args'] = map(utils.EncodeString, kwargs['args'])
+            except KeyError:
+                if len(args) > 0:
+                    targs = list(args)
+                    targs[0] = map(utils.EncodeString, args[0])
+                    args = tuple(targs)
+        
+        subprocess.Popen.__init__(self, *args, **kwargs)
+        
     def recv(self, maxsize=None):
         return self._recv('stdout', maxsize)
     
@@ -520,7 +532,7 @@
         self.startTime = time.time()
         
         try:
-            self.module = Popen(map(utils.EncodeString, self.cmd),
+            self.module = Popen(self.cmd,
                                 stdin=subprocess.PIPE,
                                 stdout=subprocess.PIPE,
                                 stderr=subprocess.PIPE,
    
    
More information about the grass-commit
mailing list