diff mercurial/ui.py @ 31079:873ebdd6e84d

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.
author Yuya Nishihara <yuya@tcha.org>
date Thu, 23 Feb 2017 21:27:25 +0900
parents 88203f26ea57
children c42feb5f3143
line wrap: on
line diff
--- 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