##// END OF EJS Templates
ui: add _isatty method to easily disable cooked I/O
Matt Mackall -
r16751:2d432a1f default
parent child Browse files
Show More
@@ -492,6 +492,11 b' class ui(object):'
492 492 try: self.ferr.flush()
493 493 except (IOError, ValueError): pass
494 494
495 def _isatty(self, fh):
496 if self.configbool('ui', 'nontty', False):
497 return False
498 return util.isatty(fh)
499
495 500 def interactive(self):
496 501 '''is interactive input allowed?
497 502
@@ -510,7 +515,7 b' class ui(object):'
510 515 if i is None:
511 516 # some environments replace stdin without implementing isatty
512 517 # usually those are non-interactive
513 return util.isatty(self.fin)
518 return self._isatty(self.fin)
514 519
515 520 return i
516 521
@@ -548,12 +553,12 b' class ui(object):'
548 553 if i is None:
549 554 # some environments replace stdout without implementing isatty
550 555 # usually those are non-interactive
551 return util.isatty(self.fout)
556 return self._isatty(self.fout)
552 557
553 558 return i
554 559
555 560 def _readline(self, prompt=''):
556 if util.isatty(self.fin):
561 if self._isatty(self.fin):
557 562 try:
558 563 # magically add command line editing support, where
559 564 # available
General Comments 0
You need to be logged in to leave comments. Login now