support for passing list command to ProcessLogger
authorgreg
Thu, 22 Oct 2009 11:27:30 +0200
changeset 424 86a7c1d11bbd
parent 423 4d7ac355701d
child 425 f390e9fdd2cf
support for passing list command to ProcessLogger
wxPopen.py
--- a/wxPopen.py	Thu Oct 22 11:26:45 2009 +0200
+++ b/wxPopen.py	Thu Oct 22 11:27:30 2009 +0200
@@ -69,16 +69,20 @@
 class ProcessLogger:
     def __init__(self, logger, Command, finish_callback=None, no_stdout=False, no_stderr=False, no_gui=True):
         self.logger = logger
-        self.Command_str = Command
-        self.Command = []
-        for i,word in enumerate(Command.replace("'",'"').split('"')):
-            if i % 2 == 0:
-                word = word.strip()
-                if len(word) > 0:
-                    self.Command.extend(word.split())
-            else:
-                self.Command.append(word)
-
+        if not isinstance(Command, list):
+            self.Command_str = Command
+            self.Command = []
+            for i,word in enumerate(Command.replace("'",'"').split('"')):
+                if i % 2 == 0:
+                    word = word.strip()
+                    if len(word) > 0:
+                        self.Command.extend(word.split())
+                else:
+                    self.Command.append(word)
+        else:
+            self.Command = Command
+            self.Command_str = subprocess.list2cmdline(self.Command)
+            
         self.finish_callback = finish_callback
         self.no_stdout = no_stdout
         self.no_stderr = no_stderr
@@ -95,6 +99,7 @@
                "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