mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
Use os.closerange() in popen2.
This commit is contained in:
parent
ffada76d04
commit
8d01bb2b19
1 changed files with 1 additions and 5 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue