summaryrefslogtreecommitdiff
path: root/git/cmd.py
diff options
context:
space:
mode:
authorTatsuki Sugiura <sugi@nemui.org>2012-05-08 09:18:36 +0900
committerTatsuki Sugiura <sugi@nemui.org>2012-05-08 09:18:36 +0900
commitcb68f36c9a2cd18a38e2b2c4630fd2131bfa3879 (patch)
tree0c4c1ea6d67c3b05f43cbae3f24becda7d5eadeb /git/cmd.py
parent6e86f8a8a0638abe2c18ae0bb36cc992b0ababe5 (diff)
downloadgitpython-cb68f36c9a2cd18a38e2b2c4630fd2131bfa3879.tar.gz
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.
Diffstat (limited to 'git/cmd.py')
-rw-r--r--git/cmd.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/git/cmd.py b/git/cmd.py
index 576a5300..385c9fff 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