Mercurial > hg
comparison hgext/pager.py @ 30847:e12553cfd0a4 stable
pager: wrap _runcommand() no matter if stdout is redirected
We've made chg utilize the common code path implemented in pager.py (by
815e1cefd082 and 493935e0327a), but the chg server does not always start
with a tty. Because of this, uisetup() of the pager extension could be
skipped on the chg server.
Kudos given to Sean Farley for dogfooding new chg and spotting this problem.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Thu, 19 Jan 2017 23:01:32 +0900 |
parents | d3e2d39b97ea |
children | aaa751585325 |
comparison
equal
deleted
inserted
replaced
30846:dfc6663f97ca | 30847:e12553cfd0a4 |
---|---|
113 os.dup2(stdoutfd, util.stdout.fileno()) | 113 os.dup2(stdoutfd, util.stdout.fileno()) |
114 os.dup2(stderrfd, util.stderr.fileno()) | 114 os.dup2(stderrfd, util.stderr.fileno()) |
115 pager.wait() | 115 pager.wait() |
116 | 116 |
117 def uisetup(ui): | 117 def uisetup(ui): |
118 if '--debugger' in sys.argv or not ui.formatted(): | |
119 return | |
120 | |
121 class pagerui(ui.__class__): | 118 class pagerui(ui.__class__): |
122 def _runpager(self, pagercmd): | 119 def _runpager(self, pagercmd): |
123 _runpager(self, pagercmd) | 120 _runpager(self, pagercmd) |
124 | 121 |
125 ui.__class__ = pagerui | 122 ui.__class__ = pagerui |
128 p = ui.config("pager", "pager", encoding.environ.get("PAGER")) | 125 p = ui.config("pager", "pager", encoding.environ.get("PAGER")) |
129 usepager = False | 126 usepager = False |
130 always = util.parsebool(options['pager']) | 127 always = util.parsebool(options['pager']) |
131 auto = options['pager'] == 'auto' | 128 auto = options['pager'] == 'auto' |
132 | 129 |
133 if not p: | 130 if not p or '--debugger' in sys.argv or not ui.formatted(): |
134 pass | 131 pass |
135 elif always: | 132 elif always: |
136 usepager = True | 133 usepager = True |
137 elif not auto: | 134 elif not auto: |
138 usepager = False | 135 usepager = False |