Use os.closerange().

This commit is contained in:
Georg Brandl 2008-02-23 22:14:02 +00:00
parent 8d01bb2b19
commit c76ea27965
1 changed files with 1 additions and 5 deletions

View File

@ -121,11 +121,7 @@ def spawn(prog, args):
sys.stderr.write('popen2: bad write dup\n') sys.stderr.write('popen2: bad write dup\n')
if os.dup(c2pwrite) <> 2: if os.dup(c2pwrite) <> 2:
sys.stderr.write('popen2: bad write dup\n') sys.stderr.write('popen2: bad write dup\n')
for i in range(3, MAXFD): os.closerange(3, MAXFD)
try:
os.close(i)
except:
pass
try: try:
os.execvp(prog, args) os.execvp(prog, args)
finally: finally: