# HG changeset patch # User Matt Mackall # Date 1337542429 18000 # Node ID 359fda6cb01d79078bf06041c9a2d88cd8c4170a # Parent 2d432a1fc0db1db268503c54aa6a74519074d9f4 pager: use ui._isatty infrastructure diff -r 2d432a1fc0db -r 359fda6cb01d hgext/pager.py --- a/hgext/pager.py Sun May 20 14:31:56 2012 -0500 +++ b/hgext/pager.py Sun May 20 14:33:49 2012 -0500 @@ -53,7 +53,7 @@ testedwith = 'internal' -def _runpager(p): +def _runpager(ui, p): pager = subprocess.Popen(p, shell=True, bufsize=-1, close_fds=util.closefds, stdin=subprocess.PIPE, stdout=sys.stdout, stderr=sys.stderr) @@ -61,7 +61,7 @@ stdout = os.dup(sys.stdout.fileno()) stderr = os.dup(sys.stderr.fileno()) os.dup2(pager.stdin.fileno(), sys.stdout.fileno()) - if util.isatty(sys.stderr): + if ui._isatty(sys.stderr): os.dup2(pager.stdin.fileno(), sys.stderr.fileno()) @atexit.register @@ -72,7 +72,7 @@ pager.wait() def uisetup(ui): - if ui.plain() or '--debugger' in sys.argv or not util.isatty(sys.stdout): + if '--debugger' in sys.argv or not ui.formatted(): return def pagecmd(orig, ui, options, cmd, cmdfunc): @@ -89,7 +89,7 @@ ui.setconfig('ui', 'interactive', False) if util.safehasattr(signal, "SIGPIPE"): signal.signal(signal.SIGPIPE, signal.SIG_DFL) - _runpager(p) + _runpager(ui, p) return orig(ui, options, cmd, cmdfunc) extensions.wrapfunction(dispatch, '_runcommand', pagecmd)