# HG changeset patch # User Matt Mackall # Date 1399658333 18000 # Node ID 2bc778e2f9b338ab776e1a5fb30c547b8468ba61 # Parent 25b7c760235ae9a1d1051aff4e68784f1a2f9e21 pager: break pager invocation out of command check loop diff -r 25b7c760235a -r 2bc778e2f9b3 hgext/pager.py --- a/hgext/pager.py Thu May 08 11:11:27 2014 -0500 +++ b/hgext/pager.py Fri May 09 12:58:53 2014 -0500 @@ -116,8 +116,11 @@ def pagecmd(orig, ui, options, cmd, cmdfunc): p = ui.config("pager", "pager", os.environ.get("PAGER")) + usepager = False - if p: + if not p: + pass + else: attend = ui.configlist('pager', 'attend', attended) auto = options['pager'] == 'auto' always = util.parsebool(options['pager']) @@ -129,12 +132,15 @@ if (always or auto and (cmd in attend or (cmd not in ignore and not attend))): - ui.setconfig('ui', 'formatted', ui.formatted(), 'pager') - ui.setconfig('ui', 'interactive', False, 'pager') - if util.safehasattr(signal, "SIGPIPE"): - signal.signal(signal.SIGPIPE, signal.SIG_DFL) - _runpager(ui, p) + usepager = True break + + if usepager: + ui.setconfig('ui', 'formatted', ui.formatted(), 'pager') + ui.setconfig('ui', 'interactive', False, 'pager') + if util.safehasattr(signal, "SIGPIPE"): + signal.signal(signal.SIGPIPE, signal.SIG_DFL) + _runpager(ui, p) return orig(ui, options, cmd, cmdfunc) extensions.wrapfunction(dispatch, '_runcommand', pagecmd)