wxPopen.py
changeset 128 3db703a78e9c
parent 112 fa0eaeaa9012
child 130 9af34a1d33b7
equal deleted inserted replaced
127:36bb6be88a3b 128:3db703a78e9c
    71         self.exitcode = None
    71         self.exitcode = None
    72         self.outdata = ""
    72         self.outdata = ""
    73         self.errdata = ""
    73         self.errdata = ""
    74         self.finished = False
    74         self.finished = False
    75         
    75         
       
    76         popenargs= {
       
    77                "cwd":os.getcwd(),
       
    78                "stdin":subprocess.PIPE, 
       
    79                "stdout":subprocess.PIPE, 
       
    80                "stderr":subprocess.PIPE}
    76         if no_gui == True and wx.Platform == '__WXMSW__':
    81         if no_gui == True and wx.Platform == '__WXMSW__':
    77             self.startupinfo = subprocess.STARTUPINFO()
    82             self.startupinfo = subprocess.STARTUPINFO()
    78             self.startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
    83             self.startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
       
    84             popenargs["startupinfo"] = self.startupinfo
       
    85         elif wx.Platform == '__WXGTK__':
       
    86             popenargs["shell"] = True
    79         
    87         
    80         self.Proc = subprocess.Popen(self.Command, 
    88         self.Proc = subprocess.Popen( self.Command, **popenargs )
    81                                    cwd = os.getcwd(),
       
    82                                    stdin = subprocess.PIPE, 
       
    83                                    stdout = subprocess.PIPE, 
       
    84                                    #stderr = subprocess.STDOUT,
       
    85                                    stderr = subprocess.PIPE,
       
    86                                    startupinfo = self.startupinfo)
       
    87 
    89 
    88 
    90 
    89         self.outt = outputThread(
    91         self.outt = outputThread(
    90                       self.Proc,
    92                       self.Proc,
    91                       self.Proc.stdout,
    93                       self.Proc.stdout,
    97         self.errt = outputThread(
    99         self.errt = outputThread(
    98                       self.Proc,
   100                       self.Proc,
    99                       self.Proc.stderr,
   101                       self.Proc.stderr,
   100                       self.errors)
   102                       self.errors)
   101 #
   103 #
   102         self.errt.start()
   104         self.errt.start()	
   103 
   105 
   104     def output(self,v):
   106     def output(self,v):
   105         self.outdata += v
   107         self.outdata += v
   106         self.outlen += 1
   108         self.outlen += 1
   107         if not self.no_stdout:
   109         if not self.no_stdout: