diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2014-11-14 15:23:53 +0100 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2014-11-14 15:23:53 +0100 |
commit | 9c5b87bcdd70810a20308384b0e3d1665f6d2922 (patch) | |
tree | aa9749d65b6000e1e7728d626d1d414d3505adca /git/cmd.py | |
parent | 9ea3dbdf67af10ccc6ad22fb3294bbd790a3698f (diff) | |
parent | b137f55232155b16aa308ec4ea8d6bc994268b0d (diff) | |
download | gitpython-9c5b87bcdd70810a20308384b0e3d1665f6d2922.tar.gz |
Merge pull request #150 from derenio/0.3
Merged fd leaks fix from the master to the 0.3 version
Diffstat (limited to 'git/cmd.py')
-rw-r--r-- | git/cmd.py | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -74,6 +74,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 @@ -85,6 +88,8 @@ class Git(LazyMixin): # try to kill it try: os.kill(self.proc.pid, 2) # interrupt signal + except OSError: + pass # ignore error when process already died except AttributeError: # try windows # for some reason, providing None for stdout/stderr still prints something. This is why @@ -101,6 +106,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 |