[issue12607] subprocess(stdout=..., stderr=sys.stdout) breaks stderr for child

STINNER Victor report at bugs.python.org
Mon Jul 25 11:51:07 CEST 2011


STINNER Victor <victor.stinner at haypocalc.com> added the comment:

save_fds should be moved outside the try block:

+            try:
+                # save a copy of the standard file descriptors
+                saved_fds = [os.dup(fd) for fd in range(3)]
+                ...
+            finally:
+                for std, saved in enumerate(saved_fds):
+                    os.dup2(saved, std)
+                    os.close(saved)


"temp_fds = [fd for fd, fname in temps]" should also be moved outside its try block.

Why not using .communicate() to write into stdin and read stdout/stderr?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12607>
_______________________________________


More information about the Python-bugs-list mailing list