summaryrefslogtreecommitdiffstats
path: root/Lib/subprocess.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-01-19 20:22:13 (GMT)
committerGeorg Brandl <georg@python.org>2008-01-19 20:22:13 (GMT)
commit309501a61772f4cb72f1004fcbe73964b4130672 (patch)
tree8737924e043d901d7c62910a97c6aebdd8e62f8e /Lib/subprocess.py
parent15ce880cc8c3de29e91e2e867b2db0b19a48e5f3 (diff)
downloadcpython-309501a61772f4cb72f1004fcbe73964b4130672.zip
cpython-309501a61772f4cb72f1004fcbe73964b4130672.tar.gz
cpython-309501a61772f4cb72f1004fcbe73964b4130672.tar.bz2
#1663329: add os.closerange() to close a range of fds,
ignoring errors, and use this in subprocess to speed up subprocess creation in close_fds mode. Patch by Mike Klaas.
Diffstat (limited to 'Lib/subprocess.py')
-rw-r--r--Lib/subprocess.py9
1 files changed, 2 insertions, 7 deletions
diff --git a/Lib/subprocess.py b/Lib/subprocess.py
index ca9489e..29c25bc 100644
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -965,13 +965,8 @@ class Popen(object):
def _close_fds(self, but):
- for i in xrange(3, MAXFD):
- if i == but:
- continue
- try:
- os.close(i)
- except:
- pass
+ os.closerange(3, but)
+ os.closerange(but + 1, MAXFD)
def _execute_child(self, args, executable, preexec_fn, close_fds,