--- a/tests/test-pager.t Mon Jun 13 13:16:17 2016 +0100
+++ b/tests/test-pager.t Sat Jun 11 20:25:49 2016 +0100
@@ -201,3 +201,24 @@
paged! '1\n'
$ A=2 hg --config pager.attend-printa=yes printa
paged! '2\n'
+
+Pager should not override the exit code of other commands
+
+ $ cat >> $TESTTMP/fortytwo.py <<'EOF'
+ > from mercurial import cmdutil, commands
+ > cmdtable = {}
+ > command = cmdutil.command(cmdtable)
+ > @command('fortytwo', [], 'fortytwo', norepo=True)
+ > def fortytwo(ui, *opts):
+ > ui.write('42\n')
+ > return 42
+ > EOF
+
+ $ cat >> $HGRCPATH <<'EOF'
+ > [extensions]
+ > fortytwo = $TESTTMP/fortytwo.py
+ > EOF
+
+ $ hg fortytwo --pager=on
+ paged! '42\n'
+ [42]