Charles-François Natali added the comment: > I don't understand why os.dup2() is more reliable than os.pipe() for a unit > test?
I use dup2() because it allows me to specify a target FD, so the parent can know precisely which FD was opened by the preexec hook, and check it's closed in the child process. With pipe(), the FDs returned are arbitrary, so the parent can't check them explicitly, and has to check that no FD > 2 is open in the child, which is fragile. > Is subprocess_close-default-1.diff portable? test_os uses hasattr(os, > "dup2"). In Modules/posixmodule.c, it looks like the function is always > defined!? Maybe it's not available on Windows, but it's definitely available on Unix. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue18763> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com