Hello, My program uses the subprocess module to spawn a child and capture its output. What I'd like to achieve is that stdout is parsed after the subprocess finishes, but anything that goes to stderr is printed immediately. The code currently looks like:
try: test = Popen(test_path, stdout=PIPE, stderr=PIPE, close_fds=True, env=test_environ) while test.poll() == None: ready = select.select([test.stderr], [], []) if test.stderr in ready[0]: t_stderr_new = test.stderr.readlines() if t_stderr_new != []: print "STDERR:", "\n".join(t_stderr_new) t_stderr.extend(t_stderr_new) except OSError, e: print >>sys.stderr, _("Test execution failed"), e else: self.result.return_code = test.returncode self.result.process(test.stdout.readlines(), t_stderr) The problem is, that it seems that all the output from the subprocess seems to be coming at once. Do I need to take a different approach? -- http://mail.python.org/mailman/listinfo/python-list