[New-bugs-announce] [issue12607] subprocess(stdout=..., stderr=sys.stdout) breaks stderr for child
Christian Häggström
report at bugs.python.org
Fri Jul 22 11:46:25 CEST 2011
New submission from Christian Häggström <pajton at kalvdans.no-ip.org>:
I hit a variant of issue #12251, namely when you redirect both stdout and stderr of a child process and one of them uses a low fd.
Testcase:
import subprocess, sys
subprocess.call(["ls", "asda"], stderr = sys.stdout, stdout = open("/dev/null", "w"))
strace output:
open("/dev/null", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
[child process]
dup2(3, 1) = 1 // overwrites the stdout filedescriptor..
dup2(1, 2) = 2 // that was supposed to be duped here.
close(3) = 0 // okay
The testcase is supposed to print "ls: file not found" on stdout, but is silent.
----------
components: Library (Lib)
messages: 140864
nosy: Evgeny.Tarasov, alexey-smirnov, chn, haypo, mmarkk, neologix, r.david.murray
priority: normal
severity: normal
status: open
title: subprocess(stdout=..., stderr=sys.stdout) breaks stderr for child
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12607>
_______________________________________
More information about the New-bugs-announce
mailing list