summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-02-23 22:09:24 (GMT)
committerGeorg Brandl <georg@python.org>2008-02-23 22:09:24 (GMT)
commit8d01bb2b19310a1fa89c166c87301c1d8f9734da (patch)
tree17a8638ef43ad7d6d44b63a166f0ebcec8ece116
parentffada76d04535ecc5b58aeaf6e152217b07df033 (diff)
downloadcpython-8d01bb2b19310a1fa89c166c87301c1d8f9734da.zip
cpython-8d01bb2b19310a1fa89c166c87301c1d8f9734da.tar.gz
cpython-8d01bb2b19310a1fa89c166c87301c1d8f9734da.tar.bz2
Use os.closerange() in popen2.
-rw-r--r--Lib/popen2.py6
1 files changed, 1 insertions, 5 deletions
diff --git a/Lib/popen2.py b/Lib/popen2.py
index dbd6533..cb769f8 100644
--- a/Lib/popen2.py
+++ b/Lib/popen2.py
@@ -82,11 +82,7 @@ class Popen3:
def _run_child(self, cmd):
if isinstance(cmd, basestring):
cmd = ['/bin/sh', '-c', cmd]
- for i in xrange(3, MAXFD):
- try:
- os.close(i)
- except OSError:
- pass
+ os.closerange(3, MAXFD)
try:
os.execvp(cmd[0], cmd)
finally: