Mercurial > public > mercurial-scm > hg-stable
diff mercurial/wireprotoserver.py @ 41285:cf8677cd7286
ui: proxy protect/restorestdio() calls to update internal flag
It should be better to manage the redirection flag solely by the ui class.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Wed, 26 Sep 2018 21:41:52 +0900 |
parents | f7011b44d205 |
children | 3e47d1ec9da5 |
line wrap: on
line diff
--- a/mercurial/wireprotoserver.py Wed Sep 26 21:29:13 2018 +0900 +++ b/mercurial/wireprotoserver.py Wed Sep 26 21:41:52 2018 +0900 @@ -24,7 +24,6 @@ from .utils import ( cborutil, interfaceutil, - procutil, ) stringio = util.stringio @@ -782,9 +781,7 @@ def __init__(self, ui, repo, logfh=None): self._ui = ui self._repo = repo - self._fin, self._fout = procutil.protectstdio(ui.fin, ui.fout) - # TODO: manage the redirection flag internally by ui - ui._finoutredirected = (self._fin, self._fout) != (ui.fin, ui.fout) + self._fin, self._fout = ui.protectfinout() # Log write I/O to stdout and stderr if configured. if logfh: @@ -795,8 +792,7 @@ def serve_forever(self): self.serveuntil(threading.Event()) - procutil.restorestdio(self._ui.fin, self._ui.fout, - self._fin, self._fout) + self._ui.restorefinout(self._fin, self._fout) sys.exit(0) def serveuntil(self, ev):