summaryrefslogtreecommitdiffstats
path: root/Demo
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-10-07 14:37:31 (GMT)
committerGuido van Rossum <guido@python.org>1997-10-07 14:37:31 (GMT)
commitd6449a2b118c26c9e322ebd6aeaf567896fdcd78 (patch)
tree60a7acfb71c63a3253d0d8a9a0513d83738f4a15 /Demo
parentef31b240ea96864faeee5a2f731e9fe1cdd5f7ac (diff)
downloadcpython-d6449a2b118c26c9e322ebd6aeaf567896fdcd78.zip
cpython-d6449a2b118c26c9e322ebd6aeaf567896fdcd78.tar.gz
cpython-d6449a2b118c26c9e322ebd6aeaf567896fdcd78.tar.bz2
Be more careful with closing fd's 0,1,2.
Diffstat (limited to 'Demo')
-rwxr-xr-xDemo/tkinter/guido/ShellWindow.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/Demo/tkinter/guido/ShellWindow.py b/Demo/tkinter/guido/ShellWindow.py
index 0b59daa..98fe30f 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: