Message226020
Josh, on Windows, if at least one standard stream is replaced; all three
hStdInput, hStdOutput, hStdError handles are provided
(all-or-nothing). On POSIX, standard streams stdin (0), stdout (1),
stderr (2) are always inherited from the parent. Each stream can be
manipulated independently. c2pwrite=-1 is different from providing
c2pwrite=1 (STDOUT_FILENO) explicitly e.g., set_inheritable() call is
made after the fork() in the latter case.
My patch leads to dup2(fileno(stdout), STDERR_FILENO) when stdout is
None and stderr=STDOUT on POSIX i.e., it redirects stderr to the
inherited stdout (like 2>&1 in the shell). It has no effect otherwise.
sys.__stdout__ is used so that the call fails sooner without fork() if
fileno(stdout) is not a valid file descriptor when python initializes
(daemon, GUI). __stdout__-based solution doesn't support a case when
fileno(stdout) is changed later in the program e.g., using freopen() on
some systems. |
|
Date |
User |
Action |
Args |
2014-08-28 12:10:12 | akira | set | recipients:
+ akira, gregory.p.smith, vstinner, r.david.murray, josh.r |
2014-08-28 12:10:11 | akira | set | messageid: <1409227811.99.0.299060727056.issue22274@psf.upfronthosting.co.za> |
2014-08-28 12:10:11 | akira | link | issue22274 messages |
2014-08-28 12:10:11 | akira | create | |
|