diff Lib/subprocess.py @ 47338:273e8de34603 legacy-trunk

Fixes issue2791: subprocess.Popen.communicate leaked a file descripton until the last reference to the Popen instance was dropped. Adding explicit close() calls fixes it. Candidate for backport to release25-maint.
author Gregory P. Smith <greg@mad-scientist.com>
date Mon, 26 May 2008 20:22:14 +0000
parents e16593da4898
children c3193b7156bb
line wrap: on
line diff
--- a/Lib/subprocess.py	Mon May 26 19:41:53 2008 +0000
+++ b/Lib/subprocess.py	Mon May 26 20:22:14 2008 +0000
@@ -661,8 +661,10 @@
                 self.stdin.close()
             elif self.stdout:
                 stdout = self.stdout.read()
+                self.stdout.close()
             elif self.stderr:
                 stderr = self.stderr.read()
+                self.stderr.close()
             self.wait()
             return (stdout, stderr)