mirror of https://github.com/python/cpython
Use os.closerange().
This commit is contained in:
parent
8d01bb2b19
commit
c76ea27965
|
@ -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:
|
||||||
|
|
Loading…
Reference in New Issue