Mercurial > public > mercurial-scm > hg-stable
diff tests/test-pager.t @ 29344:bb3d5c20eaf6
chg: exec pager in child process
Before this patch, chg uses the old pager behavior (pre 369741ef7253), which
executes pager in the main process. The user will see the exit code of the
pager, instead of the hg command.
Like 369741ef7253, this patch fixes the behavior by executing the pager in
the child process, and wait for it at the end of the main process.
author | Jun Wu <quark@fb.com> |
---|---|
date | Sat, 11 Jun 2016 20:25:49 +0100 |
parents | e095b9e753f7 |
children | e12553cfd0a4 |
line wrap: on
line diff
--- 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]