Mercurial > hg-stable
changeset 13642:994510694b1d stable
pager: don't page stderr if it's being redirected (issue2541)
author | Brodie Rao <brodie@bitheap.org> |
---|---|
date | Tue, 04 Jan 2011 00:24:34 +1100 |
parents | 2420cb1ea1d6 |
children | d943efb9701f 9777df929035 47f11b52021b |
files | hgext/pager.py |
diffstat | 1 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/pager.py Fri Mar 11 11:14:21 2011 +0100 +++ b/hgext/pager.py Tue Jan 04 00:24:34 2011 +1100 @@ -59,14 +59,17 @@ def _runpager(p): if not hasattr(os, 'fork'): - sys.stderr = sys.stdout = util.popen(p, 'wb') + sys.stdout = util.popen(p, 'wb') + if sys.stderr.isatty(): + sys.stderr = sys.stdout return fdin, fdout = os.pipe() pid = os.fork() if pid == 0: os.close(fdin) os.dup2(fdout, sys.stdout.fileno()) - os.dup2(fdout, sys.stderr.fileno()) + if sys.stderr.isatty(): + os.dup2(fdout, sys.stderr.fileno()) os.close(fdout) return os.dup2(fdin, sys.stdin.fileno())