Mercurial > public > mercurial-scm > hg-stable
diff mercurial/subrepo.py @ 52630:35cc15fbc523
subrepo: don't leak a file descriptor when running a git command
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Tue, 17 Dec 2024 16:02:58 -0500 |
parents | 9d79ffeed7c0 |
children | 5cc8deb96b48 |
line wrap: on
line diff
--- a/mercurial/subrepo.py Mon Dec 16 21:50:24 2024 -0500 +++ b/mercurial/subrepo.py Tue Dec 17 16:02:58 2024 -0500 @@ -1966,11 +1966,11 @@ # TODO: add support for non-plain formatter (see cmdutil.cat()) for f in match.files(): output = self._gitcommand([b"show", b"%s:%s" % (rev, f)]) - fp = cmdutil.makefileobj( + with cmdutil.makefileobj( self._ctx, fntemplate, pathname=self.wvfs.reljoin(prefix, f) - ) - fp.write(output) - fp.close() + ) as fp: + fp.write(output) + return 0 @annotatesubrepoerror