From 56cc93a548f35a0becd49a7eacde86f55ffc5dc5 Mon Sep 17 00:00:00 2001 From: Tatsuki Sugiura Date: Tue, 8 May 2012 09:18:36 +0900 Subject: Fix fd leak on git cmd. Currently if command is called with as_proces=True, pipes for the command will not be closed. This change makes sure to close command file descriptors. Conflicts: git/cmd.py --- git/cmd.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/git/cmd.py b/git/cmd.py index 2d4aa727..c342148f 100644 --- a/git/cmd.py +++ b/git/cmd.py @@ -73,6 +73,9 @@ class Git(LazyMixin): self.args = args def __del__(self): + self.proc.stdout.close() + self.proc.stderr.close() + # did the process finish already so we have a return code ? if self.proc.poll() is not None: return @@ -100,6 +103,8 @@ class Git(LazyMixin): :raise GitCommandError: if the return status is not 0""" status = self.proc.wait() + self.proc.stdout.close() + self.proc.stderr.close() if status != 0: raise GitCommandError(self.args, status, self.proc.stderr.read()) # END status handling -- cgit v1.2.1