changeset 16632:0c0c1101e46d stable

pager: remove quiet flag With the pager running as a child process, exiting the pager doesn't result in a broken pipe message. To distinguish the exit broken pipe code from a mercurial abort we register the default action for SIGPIPE. This results in a 141 exit code instead of a 255. On windows SIGPIPE doesn't exists and a ValueError will be thrown.
author David Soria Parra <dsp@php.net>
date Fri, 11 May 2012 16:08:49 +0200
parents 369741ef7253
children b2ca2f40c9c1
files hgext/pager.py
diffstat 1 files changed, 4 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/pager.py	Fri May 11 15:45:37 2012 +0200
+++ b/hgext/pager.py	Fri May 11 16:08:49 2012 +0200
@@ -22,12 +22,6 @@
 If no pager is set, the pager extensions uses the environment variable
 $PAGER. If neither pager.pager, nor $PAGER is set, no pager is used.
 
-If you notice "BROKEN PIPE" error messages, you can disable them by
-setting::
-
-  [pager]
-  quiet = True
-
 You can disable the pager for certain commands by adding them to the
 pager.ignore list::
 
@@ -91,9 +85,11 @@
                  (cmd not in ui.configlist('pager', 'ignore') and not attend))):
                 ui.setconfig('ui', 'formatted', ui.formatted())
                 ui.setconfig('ui', 'interactive', False)
+                try:
+                    signal.signal(signal.SIGPIPE, signal.SIG_DFL)
+                except ValueError:
+                    pass
                 _runpager(p)
-                if ui.configbool('pager', 'quiet'):
-                    signal.signal(signal.SIGPIPE, signal.SIG_DFL)
         return orig(ui, options, cmd, cmdfunc)
 
     extensions.wrapfunction(dispatch, '_runcommand', pagecmd)