Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commandserver.py @ 41284:b0e3f2d7c143
ui: move protectedstdio() context manager from procutil
This is a follow-up series for 23a00bc90a3c, "chgserver: do not send system()
back to client if stdio redirected." The function is renamed using ui terms.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Wed, 26 Sep 2018 21:29:13 +0900 |
parents | dcac24ec935b |
children | 2372284d9457 |
comparison
equal
deleted
inserted
replaced
41283:4948b327d3b9 | 41284:b0e3f2d7c143 |
---|---|
397 | 397 |
398 def run(self): | 398 def run(self): |
399 ui = self.ui | 399 ui = self.ui |
400 # redirect stdio to null device so that broken extensions or in-process | 400 # redirect stdio to null device so that broken extensions or in-process |
401 # hooks will never cause corruption of channel protocol. | 401 # hooks will never cause corruption of channel protocol. |
402 with procutil.protectedstdio(ui.fin, ui.fout) as (fin, fout): | 402 with ui.protectedfinout() as (fin, fout): |
403 sv = server(ui, self.repo, fin, fout) | 403 sv = server(ui, self.repo, fin, fout) |
404 try: | 404 try: |
405 return sv.serve() | 405 return sv.serve() |
406 finally: | 406 finally: |
407 sv.cleanup() | 407 sv.cleanup() |