Mercurial > hg
diff hgext/pager.py @ 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 | 919c440868d9 |
children | 76f295eaed86 |
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())