Skip to content

Merged fd leaks fix from the master to the 0.3 version #150

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 14, 2014
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
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
  • Loading branch information
sugi authored and derenio committed Mar 31, 2014
commit 56cc93a548f35a0becd49a7eacde86f55ffc5dc5
5 changes: 5 additions & 0 deletions git/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ def __init__(self, proc, args ):
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
Expand Down Expand Up @@ -100,6 +103,8 @@ def wait(self):

: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
Expand Down