mirror of
https://github.com/python/cpython.git
synced 2025-07-31 23:23:11 +00:00
#6189: The subprocess.py module should be kept compatible with python 2.2
(On windows, you still have to change one line to use pywin32 instead of the _subprocess helper module)
This commit is contained in:
parent
c29863e3a6
commit
5fe420e34c
2 changed files with 14 additions and 3 deletions
|
@ -500,7 +500,7 @@ def check_output(*popenargs, **kwargs):
|
||||||
"""
|
"""
|
||||||
if 'stdout' in kwargs:
|
if 'stdout' in kwargs:
|
||||||
raise ValueError('stdout argument not allowed, it will be overridden.')
|
raise ValueError('stdout argument not allowed, it will be overridden.')
|
||||||
process = Popen(*popenargs, stdout=PIPE, **kwargs)
|
process = Popen(stdout=PIPE, *popenargs, **kwargs)
|
||||||
output, unused_err = process.communicate()
|
output, unused_err = process.communicate()
|
||||||
retcode = process.poll()
|
retcode = process.poll()
|
||||||
if retcode:
|
if retcode:
|
||||||
|
@ -1020,8 +1020,17 @@ class Popen(object):
|
||||||
|
|
||||||
|
|
||||||
def _close_fds(self, but):
|
def _close_fds(self, but):
|
||||||
os.closerange(3, but)
|
if hasattr(os, 'closerange'):
|
||||||
os.closerange(but + 1, MAXFD)
|
os.closerange(3, but)
|
||||||
|
os.closerange(but + 1, MAXFD)
|
||||||
|
else:
|
||||||
|
for i in xrange(3, MAXFD):
|
||||||
|
if i == but:
|
||||||
|
continue
|
||||||
|
try:
|
||||||
|
os.close(i)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def _execute_child(self, args, executable, preexec_fn, close_fds,
|
def _execute_child(self, args, executable, preexec_fn, close_fds,
|
||||||
|
|
|
@ -327,6 +327,8 @@ Core and Builtins
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #6189: Restored compatibility of subprocess.py with Python 2.2.
|
||||||
|
|
||||||
- Issue #6287: Added the license field in Distutils documentation.
|
- Issue #6287: Added the license field in Distutils documentation.
|
||||||
|
|
||||||
- Issue #6286: Now Distutils upload command is based on urllib2 instead of
|
- Issue #6286: Now Distutils upload command is based on urllib2 instead of
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue