Be more careful with closing fd's 0,1,2.
This commit is contained in:
parent
ef31b240ea
commit
d6449a2b11
|
@ -110,9 +110,11 @@ def spawn(prog, args):
|
||||||
pid = os.fork()
|
pid = os.fork()
|
||||||
if pid == 0:
|
if pid == 0:
|
||||||
# Child
|
# Child
|
||||||
os.close(0)
|
for i in 0, 1, 2:
|
||||||
os.close(1)
|
try:
|
||||||
os.close(2)
|
os.close(i)
|
||||||
|
except os.error:
|
||||||
|
pass
|
||||||
if os.dup(p2cread) <> 0:
|
if os.dup(p2cread) <> 0:
|
||||||
sys.stderr.write('popen2: bad read dup\n')
|
sys.stderr.write('popen2: bad read dup\n')
|
||||||
if os.dup(c2pwrite) <> 1:
|
if os.dup(c2pwrite) <> 1:
|
||||||
|
|
Loading…
Reference in New Issue