Skip to content

Commit

Permalink
Be more careful with closing fd's 0,1,2.
Browse files Browse the repository at this point in the history
  • Loading branch information
gvanrossum committed Oct 7, 1997
1 parent ef31b24 commit d6449a2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Demo/tkinter/guido/ShellWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,11 @@ def spawn(prog, args):
pid = os.fork()
if pid == 0:
# Child
os.close(0)
os.close(1)
os.close(2)
for i in 0, 1, 2:
try:
os.close(i)
except os.error:
pass
if os.dup(p2cread) <> 0:
sys.stderr.write('popen2: bad read dup\n')
if os.dup(c2pwrite) <> 1:
Expand Down

0 comments on commit d6449a2

Please sign in to comment.