def run(self): if self.cwd is not None: print '[' + ' '.join(self.command) + '] in ' + self.cwd else: print '[' + ' '.join(self.command) + ']' self.p = subprocess.Popen(self.command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=self.cwd)
self.stdout_lines = [] for stdout_line in iter(self.p.stdout.readline, b''): if self.writeConsole: sys.stdout.write(stdout_line) self.stdout_lines.append(stdout_line)
self.stderr_lines = [] for stderr_line in iter(self.p.stderr.readline, b''): if self.writeConsole: sys.stderr.write(stderr_line) self.stderr_lines.append(stderr_line)