summaryrefslogtreecommitdiffstats
path: root/Lib/subprocess.py
diff options
context:
space:
mode:
authorMartin Panter <vadmium+py@gmail.com>2016-05-13 01:54:44 (GMT)
committerMartin Panter <vadmium+py@gmail.com>2016-05-13 01:54:44 (GMT)
commit1edccfa60a8f09ccf6b771141e28e7184f03a57b (patch)
treed5a5a98832d92dd22162b7a9f183eda55bea78b0 /Lib/subprocess.py
parent413a8e1b1b81d2de5283ca917eef4c8c7006cdb0 (diff)
downloadcpython-1edccfa60a8f09ccf6b771141e28e7184f03a57b.zip
cpython-1edccfa60a8f09ccf6b771141e28e7184f03a57b.tar.gz
cpython-1edccfa60a8f09ccf6b771141e28e7184f03a57b.tar.bz2
Issue #22274: Redirect stderr=STDOUT when stdout not redirected, by Akira Li
Diffstat (limited to 'Lib/subprocess.py')
-rw-r--r--Lib/subprocess.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/subprocess.py b/Lib/subprocess.py
index 78189f4..70d129b3 100644
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -1142,7 +1142,10 @@ class Popen(object):
errread, errwrite = self.pipe_cloexec()
to_close.update((errread, errwrite))
elif stderr == STDOUT:
- errwrite = c2pwrite
+ if c2pwrite is not None:
+ errwrite = c2pwrite
+ else: # child's stdout is not set, use parent's stdout
+ errwrite = sys.__stdout__.fileno()
elif isinstance(stderr, int):
errwrite = stderr
else: