diff options
author | Martin Panter <vadmium+py@gmail.com> | 2016-05-13 01:54:44 (GMT) |
---|---|---|
committer | Martin Panter <vadmium+py@gmail.com> | 2016-05-13 01:54:44 (GMT) |
commit | c76358924f5d750460f8693c05987dd866cb9e8a (patch) | |
tree | edfd33c7e4984f84e6696e2bfbc469b37fc3e4c0 /Lib/subprocess.py | |
parent | 07451ddd4f9db9cfdffdabca360d5873394d305c (diff) | |
download | cpython-c76358924f5d750460f8693c05987dd866cb9e8a.zip cpython-c76358924f5d750460f8693c05987dd866cb9e8a.tar.gz cpython-c76358924f5d750460f8693c05987dd866cb9e8a.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.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/subprocess.py b/Lib/subprocess.py index d1324b8..4d316e6 100644 --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -1401,7 +1401,10 @@ class Popen(object): elif stderr == PIPE: errread, errwrite = os.pipe() elif stderr == STDOUT: - errwrite = c2pwrite + if c2pwrite != -1: + errwrite = c2pwrite + else: # child's stdout is not set, use parent's stdout + errwrite = sys.__stdout__.fileno() elif stderr == DEVNULL: errwrite = self._get_devnull() elif isinstance(stderr, int): |