# HG changeset patch # User Mads Kiilerich # Date 2014-09-24 14:24:40 # Node ID 2f18ebfead0cd4bb2589d2fc734487eb14a499f6 # Parent b3f12c354e871fa81aec13b242560554aeea9ab1 vcs: close SubprocessIOChunker inputstream used for git (Issue #32) git clone was leaking file descriptors diff --git a/kallithea/lib/vcs/subprocessio.py b/kallithea/lib/vcs/subprocessio.py --- a/kallithea/lib/vcs/subprocessio.py +++ b/kallithea/lib/vcs/subprocessio.py @@ -386,6 +386,7 @@ class SubprocessIOChunker(object): self.process = _p self.output = bg_out self.error = bg_err + self.inputstream = inputstream def __iter__(self): return self @@ -413,6 +414,10 @@ class SubprocessIOChunker(object): self.error.close() except: pass + try: + os.close(self.inputstream) + except: + pass def __del__(self): self.close()