util/ProcessLogger.py
changeset 1878 fb73a6b6622d
parent 1850 614396cbffbf
child 1881 091005ec69c4
equal deleted inserted replaced
1877:da5f1fa46f2b 1878:fb73a6b6622d
   115         self.startsem = Semaphore(0)
   115         self.startsem = Semaphore(0)
   116         self.finishsem = Semaphore(0)
   116         self.finishsem = Semaphore(0)
   117         self.endlock = Lock()
   117         self.endlock = Lock()
   118 
   118 
   119         popenargs = {
   119         popenargs = {
   120                "cwd":    os.getcwd() if cwd is None else cwd,
   120             "cwd":    os.getcwd() if cwd is None else cwd,
   121                "stdin":  subprocess.PIPE,
   121             "stdin":  subprocess.PIPE,
   122                "stdout": subprocess.PIPE,
   122             "stdout": subprocess.PIPE,
   123                "stderr": subprocess.PIPE
   123             "stderr": subprocess.PIPE
   124         }
   124         }
   125 
   125 
   126         if no_gui and wx.Platform == '__WXMSW__':
   126         if no_gui and wx.Platform == '__WXMSW__':
   127             self.startupinfo = subprocess.STARTUPINFO()
   127             self.startupinfo = subprocess.STARTUPINFO()
   128             self.startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
   128             self.startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
   137             self.timeout = None
   137             self.timeout = None
   138 
   138 
   139         self.Proc = subprocess.Popen(self.Command, **popenargs)
   139         self.Proc = subprocess.Popen(self.Command, **popenargs)
   140 
   140 
   141         self.outt = outputThread(
   141         self.outt = outputThread(
   142                       self.Proc,
   142             self.Proc,
   143                       self.Proc.stdout,
   143             self.Proc.stdout,
   144                       self.output,
   144             self.output,
   145                       self.finish)
   145             self.finish)
   146         self.outt.start()
   146         self.outt.start()
   147 
   147 
   148         self.errt = outputThread(
   148         self.errt = outputThread(
   149                       self.Proc,
   149             self.Proc,
   150                       self.Proc.stderr,
   150             self.Proc.stderr,
   151                       self.errors)
   151             self.errors)
   152         self.errt.start()
   152         self.errt.start()
   153         self.startsem.release()
   153         self.startsem.release()
   154 
   154 
   155     def output(self, v):
   155     def output(self, v):
   156         self.outdata.append(v)
   156         self.outdata.append(v)