# HG changeset patch # User Yuya Nishihara # Date 1487852845 -32400 # Node ID 873ebdd6e84d60f13aae1851d55a5a3ec340a2d8 # Parent a113284f54a01bf0091236bb6e34e497b90e6794 pager: do not try to run an empty pager command If pagercmd is explicitly set to '', the pager process would exit silently and the output would be lost. We'd better disable the pager in such case. diff -r a113284f54a0 -r 873ebdd6e84d mercurial/ui.py --- a/mercurial/ui.py Thu Feb 23 21:20:26 2017 +0900 +++ b/mercurial/ui.py Thu Feb 23 21:27:25 2017 +0900 @@ -869,7 +869,6 @@ # interactive, the user didn't say HGPLAIN or # HGPLAINEXCEPT=pager, and the user didn't specify --debug. return - self.debug('starting pager for command %r\n' % command) # TODO: add a "system defaults" config section so this default # of more(1) can be easily replaced with a global @@ -879,6 +878,10 @@ # default editor command similar treatment. envpager = encoding.environ.get('PAGER', 'more') pagercmd = self.config('pager', 'pager', envpager) + if not pagercmd: + return + + self.debug('starting pager for command %r\n' % command) self.pageractive = True # Preserve the formatted-ness of the UI. This is important # because we mess with stdout, which might confuse diff -r a113284f54a0 -r 873ebdd6e84d tests/test-pager.t --- a/tests/test-pager.t Thu Feb 23 21:20:26 2017 +0900 +++ b/tests/test-pager.t Thu Feb 23 21:27:25 2017 +0900 @@ -89,6 +89,12 @@ $ hg log -l1 -q --config ui.formatted=False 10:46106edeeb38 +Pager should be disabled if pager.pager is empty (otherwise the output would +be silently lost.) + + $ hg log -l1 -q --config pager.pager= + 10:46106edeeb38 + Pager with color enabled allows colors to come through by default, even though stdout is no longer a tty. $ cat >> $HGRCPATH <