##// 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 try: self.ferr.flush()
492 try: self.ferr.flush()
493 except (IOError, ValueError): pass
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 def interactive(self):
500 def interactive(self):
496 '''is interactive input allowed?
501 '''is interactive input allowed?
497
502
@@ -510,7 +515,7 b' class ui(object):'
510 if i is None:
515 if i is None:
511 # some environments replace stdin without implementing isatty
516 # some environments replace stdin without implementing isatty
512 # usually those are non-interactive
517 # usually those are non-interactive
513 return util.isatty(self.fin)
518 return self._isatty(self.fin)
514
519
515 return i
520 return i
516
521
@@ -548,12 +553,12 b' class ui(object):'
548 if i is None:
553 if i is None:
549 # some environments replace stdout without implementing isatty
554 # some environments replace stdout without implementing isatty
550 # usually those are non-interactive
555 # usually those are non-interactive
551 return util.isatty(self.fout)
556 return self._isatty(self.fout)
552
557
553 return i
558 return i
554
559
555 def _readline(self, prompt=''):
560 def _readline(self, prompt=''):
556 if util.isatty(self.fin):
561 if self._isatty(self.fin):
557 try:
562 try:
558 # magically add command line editing support, where
563 # magically add command line editing support, where
559 # available
564 # available
General Comments 0
You need to be logged in to leave comments. Login now