From: Guido van Rossum Date: Tue, 7 Oct 1997 14:37:31 +0000 (+0000) Subject: Be more careful with closing fd's 0,1,2. X-Git-Tag: v1.5a4~57 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d6449a2b118c26c9e322ebd6aeaf567896fdcd78;p=python Be more careful with closing fd's 0,1,2. --- diff --git a/Demo/tkinter/guido/ShellWindow.py b/Demo/tkinter/guido/ShellWindow.py index 0b59daacbf..98fe30f70d 100755 --- a/Demo/tkinter/guido/ShellWindow.py +++ b/Demo/tkinter/guido/ShellWindow.py @@ -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: