mercurial/ui.py
changeset 41284 b0e3f2d7c143
parent 41225 44914de4e915
child 41285 cf8677cd7286
equal deleted inserted replaced
41283:4948b327d3b9 41284:b0e3f2d7c143
  1078     def _isatty(self, fh):
  1078     def _isatty(self, fh):
  1079         if self.configbool('ui', 'nontty'):
  1079         if self.configbool('ui', 'nontty'):
  1080             return False
  1080             return False
  1081         return procutil.isatty(fh)
  1081         return procutil.isatty(fh)
  1082 
  1082 
       
  1083     @contextlib.contextmanager
       
  1084     def protectedfinout(self):
       
  1085         """Run code block with protected standard streams"""
       
  1086         fin, fout = procutil.protectstdio(self._fin, self._fout)
       
  1087         try:
       
  1088             yield fin, fout
       
  1089         finally:
       
  1090             procutil.restorestdio(self._fin, self._fout, fin, fout)
       
  1091 
  1083     def disablepager(self):
  1092     def disablepager(self):
  1084         self._disablepager = True
  1093         self._disablepager = True
  1085 
  1094 
  1086     def pager(self, command):
  1095     def pager(self, command):
  1087         """Start a pager for subsequent command output.
  1096         """Start a pager for subsequent command output.