Mercurial > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
29343:e095b9e753f7 | 29344:bb3d5c20eaf6 |
---|---|
199 | 199 |
200 $ A=1 hg --config pager.attend-printa=yes printa | 200 $ A=1 hg --config pager.attend-printa=yes printa |
201 paged! '1\n' | 201 paged! '1\n' |
202 $ A=2 hg --config pager.attend-printa=yes printa | 202 $ A=2 hg --config pager.attend-printa=yes printa |
203 paged! '2\n' | 203 paged! '2\n' |
204 | |
205 Pager should not override the exit code of other commands | |
206 | |
207 $ cat >> $TESTTMP/fortytwo.py <<'EOF' | |
208 > from mercurial import cmdutil, commands | |
209 > cmdtable = {} | |
210 > command = cmdutil.command(cmdtable) | |
211 > @command('fortytwo', [], 'fortytwo', norepo=True) | |
212 > def fortytwo(ui, *opts): | |
213 > ui.write('42\n') | |
214 > return 42 | |
215 > EOF | |
216 | |
217 $ cat >> $HGRCPATH <<'EOF' | |
218 > [extensions] | |
219 > fortytwo = $TESTTMP/fortytwo.py | |
220 > EOF | |
221 | |
222 $ hg fortytwo --pager=on | |
223 paged! '42\n' | |
224 [42] |