Message137510
How to test:
----------------
#! /usr/bin/python
import subprocess, sys
# will print err to sys.stderr
subprocess.call(['rmdir', '/no_such_dir'])
# will NOT print err to sys.stderr
subprocess.call(['rmdir', '/no_such_dir'], stdout=sys.stderr)
----------------
According to strace, in child process:
-----------------
dup2(2, 1) // that's what I expect, okay
close(2) // that's I was not expect, so bug here
execve(...)
-----------------
Bug is in subprocess.py:
(search for "dup2" in file)
I do not known how to fix correctly. Logick in this module is brain damaged in some places.
-----------------------------
# Dup fds for child
if p2cread is not None:
os.dup2(p2cread, 0)
if c2pwrite is not None:
os.dup2(c2pwrite, 1)
if errwrite is not None:
os.dup2(errwrite, 2)
# Close pipe fds. Make sure we don't close the same
# fd more than once, or standard fds.
if p2cread is not None and p2cread not in (0,):
os.close(p2cread)
if c2pwrite is not None and c2pwrite not in (p2cread, 1):
os.close(c2pwrite)
if errwrite is not None and errwrite not in (p2cread, c2pwrite, 2):
os.close(errwrite)
------------------------- |
|
Date |
User |
Action |
Args |
2011-06-03 09:47:09 | socketpair | set | recipients:
+ socketpair |
2011-06-03 09:47:08 | socketpair | set | messageid: <1307094428.89.0.00113133109323.issue12251@psf.upfronthosting.co.za> |
2011-06-03 09:47:08 | socketpair | link | issue12251 messages |
2011-06-03 09:47:07 | socketpair | create | |
|