changeset 4517:2f18ebfead0c

vcs: close SubprocessIOChunker inputstream used for git (Issue #32) git clone was leaking file descriptors
author Mads Kiilerich <madski@unity3d.com>
date Wed, 24 Sep 2014 14:24:40 +0200
parents b3f12c354e87
children 8cf1d694bda0
files kallithea/lib/vcs/subprocessio.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/vcs/subprocessio.py	Wed Sep 24 14:24:40 2014 +0200
+++ b/kallithea/lib/vcs/subprocessio.py	Wed Sep 24 14:24:40 2014 +0200
@@ -386,6 +386,7 @@
         self.process = _p
         self.output = bg_out
         self.error = bg_err
+        self.inputstream = inputstream
 
     def __iter__(self):
         return self
@@ -413,6 +414,10 @@
             self.error.close()
         except:
             pass
+        try:
+            os.close(self.inputstream)
+        except:
+            pass
 
     def __del__(self):
         self.close()