Changeset - 8dbe46ca608f
[Not reviewed]
default
0 1 0
Mads Kiilerich - 6 years ago 2019-10-03 22:52:53
mads@kiilerich.com
Grafted from: f922eb714cfd
vcs: close SubprocessIOChunker after use - it has a close method, so let's make sure we use it

It might not be strictly necessary, but it might free some resources earlier.
1 file changed with 3 insertions and 0 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/vcs/backends/git/repository.py
Show inline comments
 
@@ -135,25 +135,28 @@ class GitRepository(BaseRepository):
 
            )
 
            _opts.update(opts)
 
            p = subprocessio.SubprocessIOChunker(cmd, **_opts)
 
        except (EnvironmentError, OSError) as err:
 
            tb_err = ("Couldn't run git command (%s).\n"
 
                      "Original error was:%s\n" % (cmd, err))
 
            log.error(tb_err)
 
            if safe_call:
 
                return '', err
 
            else:
 
                raise RepositoryError(tb_err)
 

	
 
        try:
 
        return ''.join(p.output), ''.join(p.error)
 
        finally:
 
            p.close()
 

	
 
    def run_git_command(self, cmd):
 
        opts = {}
 
        if os.path.isdir(self.path):
 
            opts['cwd'] = self.path
 
        return self._run_git_command(cmd, **opts)
 

	
 
    @classmethod
 
    def _check_url(cls, url):
 
        """
 
        Function will check given url and try to verify if it's a valid
 
        link. Sometimes it may happened that git will issue basic
0 comments (0 inline, 0 general)