diff Lib/subprocess.py @ 40566:7a11a3abe64c legacy-trunk

Re-implemented fix for #1531862 once again, in a way that works with Python 2.2. Fixes bug #1603424.
author Peter Astrand <astrand@lysator.liu.se>
date Sun, 07 Jan 2007 08:53:46 +0000
parents a3222075f5c6
children 1409e1f273b5 99093b527c01
line wrap: on
line diff
--- a/Lib/subprocess.py	Sat Jan 06 21:24:35 2007 +0000
+++ b/Lib/subprocess.py	Sun Jan 07 08:53:46 2007 +0000
@@ -1004,8 +1004,12 @@
 
                     # Close pipe fds.  Make sure we don't close the same
                     # fd more than once, or standard fds.
-                    for fd in set((p2cread, c2pwrite, errwrite))-set((0,1,2)):
-                        if fd: os.close(fd)
+                    if p2cread and p2cread not in (0,):
+                        os.close(p2cread)
+                    if c2pwrite and c2pwrite not in (p2cread, 1):
+                        os.close(c2pwrite)
+                    if errwrite and errwrite not in (p2cread, c2pwrite, 2):
+                        os.close(errwrite)
 
                     # Close all other fds, if asked for
                     if close_fds: