fixed subprocess launching on linux (avoid use of undefied self.startupinfo and use use Shell=True (bash will split arguments))
authorgreg
Tue, 11 Mar 2008 10:38:12 +0100
changeset 128 3db703a78e9c
parent 127 36bb6be88a3b
child 129 ec54cd416528
fixed subprocess launching on linux (avoid use of undefied self.startupinfo and use use Shell=True (bash will split arguments))
wxPopen.py
--- a/wxPopen.py	Thu Mar 06 14:23:04 2008 +0100
+++ b/wxPopen.py	Tue Mar 11 10:38:12 2008 +0100
@@ -73,17 +73,19 @@
         self.errdata = ""
         self.finished = False
         
+        popenargs= {
+               "cwd":os.getcwd(),
+               "stdin":subprocess.PIPE, 
+               "stdout":subprocess.PIPE, 
+               "stderr":subprocess.PIPE}
         if no_gui == True and wx.Platform == '__WXMSW__':
             self.startupinfo = subprocess.STARTUPINFO()
             self.startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
+            popenargs["startupinfo"] = self.startupinfo
+        elif wx.Platform == '__WXGTK__':
+            popenargs["shell"] = True
         
-        self.Proc = subprocess.Popen(self.Command, 
-                                   cwd = os.getcwd(),
-                                   stdin = subprocess.PIPE, 
-                                   stdout = subprocess.PIPE, 
-                                   #stderr = subprocess.STDOUT,
-                                   stderr = subprocess.PIPE,
-                                   startupinfo = self.startupinfo)
+        self.Proc = subprocess.Popen( self.Command, **popenargs )
 
 
         self.outt = outputThread(
@@ -99,7 +101,7 @@
                       self.Proc.stderr,
                       self.errors)
 #
-        self.errt.start()
+        self.errt.start()	
 
     def output(self,v):
         self.outdata += v