summaryrefslogtreecommitdiff
path: root/Lib/subprocess.py
diff options
context:
space:
mode:
authorÉric Araujo <merwok@netwok.org>2011-07-28 23:08:11 +0200
committerÉric Araujo <merwok@netwok.org>2011-07-28 23:08:11 +0200
commitcf534817adc49b2562d175fabd3e3992d25063fe (patch)
treed2cb18e71d6b5cc25384146751b00c2172a327b6 /Lib/subprocess.py
parent9e1af03fbb2a9fc1472ac866add02c99b0c88b16 (diff)
parentfc662ddda2bfd43b10c0a4f8a814e36445f22515 (diff)
downloadcpython-git-cf534817adc49b2562d175fabd3e3992d25063fe.tar.gz
Branch merge
Diffstat (limited to 'Lib/subprocess.py')
-rw-r--r--Lib/subprocess.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/subprocess.py b/Lib/subprocess.py
index ddbca6ab1b..2d85b50710 100644
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -1219,6 +1219,14 @@ class Popen(object):
os.close(errread)
os.close(errpipe_read)
+ # When duping fds, if there arises a situation
+ # where one of the fds is either 0, 1 or 2, it
+ # is possible that it is overwritten (#12607).
+ if c2pwrite == 0:
+ c2pwrite = os.dup(c2pwrite)
+ if errwrite == 0 or errwrite == 1:
+ errwrite = os.dup(errwrite)
+
# Dup fds for child
def _dup2(a, b):
# dup2() removes the CLOEXEC flag but