Changeset - 2f18ebfead0c
[Not reviewed]
default
0 1 0
Mads Kiilerich - 11 years ago 2014-09-24 14:24:40
madski@unity3d.com
vcs: close SubprocessIOChunker inputstream used for git (Issue #32)

git clone was leaking file descriptors
1 file changed with 5 insertions and 0 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/vcs/subprocessio.py
Show inline comments
 
@@ -383,12 +383,13 @@ class SubprocessIOChunker(object):
 
            raise EnvironmentError(
 
                "Subprocess exited with non 0 ret code:%s" % _returncode)
 

	
 
        self.process = _p
 
        self.output = bg_out
 
        self.error = bg_err
 
        self.inputstream = inputstream
 

	
 
    def __iter__(self):
 
        return self
 

	
 
    def next(self):
 
        if self.process.poll():
 
@@ -410,9 +411,13 @@ class SubprocessIOChunker(object):
 
        except:
 
            pass
 
        try:
 
            self.error.close()
 
        except:
 
            pass
 
        try:
 
            os.close(self.inputstream)
 
        except:
 
            pass
 

	
 
    def __del__(self):
 
        self.close()
0 comments (0 inline, 0 general)