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.
This commit is contained in:
Gregory P. Smith 2008-05-26 20:22:14 +00:00
parent 3aa84a7f28
commit 4036fd4b75
2 changed files with 21 additions and 5 deletions

View file

@ -661,8 +661,10 @@ class Popen(object):
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)