Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 56cc93a

Browse files
sugiderenio
authored andcommitted
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
1 parent 56d5d0c commit 56cc93a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

git/cmd.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ def __init__(self, proc, args ):
7373
self.args = args
7474

7575
def __del__(self):
76+
self.proc.stdout.close()
77+
self.proc.stderr.close()
78+
7679
# did the process finish already so we have a return code ?
7780
if self.proc.poll() is not None:
7881
return
@@ -100,6 +103,8 @@ def wait(self):
100103
101104
:raise GitCommandError: if the return status is not 0"""
102105
status = self.proc.wait()
106+
self.proc.stdout.close()
107+
self.proc.stderr.close()
103108
if status != 0:
104109
raise GitCommandError(self.args, status, self.proc.stderr.read())
105110
# END status handling

0 commit comments

Comments
 (0)