##// END OF EJS Templates
chg: always wait for pager...
Jun Wu -
r31890:ca7af5d1 default
parent child Browse files
Show More
@@ -447,11 +447,11 b' int main(int argc, const char *argv[], c'
447 }
447 }
448
448
449 setupsignalhandler(hgc_peerpid(hgc), hgc_peerpgid(hgc));
449 setupsignalhandler(hgc_peerpid(hgc), hgc_peerpgid(hgc));
450 atexit(waitpager);
450 int exitcode = hgc_runcommand(hgc, argv + 1, argc - 1);
451 int exitcode = hgc_runcommand(hgc, argv + 1, argc - 1);
451 restoresignalhandler();
452 restoresignalhandler();
452 hgc_close(hgc);
453 hgc_close(hgc);
453 freecmdserveropts(&opts);
454 freecmdserveropts(&opts);
454 waitpager();
455
455
456 return exitcode;
456 return exitcode;
457 }
457 }
@@ -102,6 +102,37 b' pager should be enabled if the attached '
102 $ chg log -l1 -q --config ui.formatted=False
102 $ chg log -l1 -q --config ui.formatted=False
103 0:1f7b0de80e11
103 0:1f7b0de80e11
104
104
105 chg waits for pager if runcommand raises
106
107 $ cat > $TESTTMP/crash.py <<EOF
108 > from mercurial import cmdutil
109 > cmdtable = {}
110 > command = cmdutil.command(cmdtable)
111 > @command('crash')
112 > def pagercrash(ui, repo, *pats, **opts):
113 > ui.write('going to crash\n')
114 > raise Exception('.')
115 > EOF
116
117 $ cat > $TESTTMP/fakepager.py <<EOF
118 > import sys, time
119 > for line in iter(sys.stdin.readline, ''):
120 > if 'crash' in line: # only interested in lines containing 'crash'
121 > # if chg exits when pager is sleeping (incorrectly), the output
122 > # will be captured by the next test case
123 > time.sleep(1)
124 > sys.stdout.write('crash-pager: %s' % line)
125 > EOF
126
127 $ cat >> .hg/hgrc <<EOF
128 > [extensions]
129 > crash = $TESTTMP/crash.py
130 > EOF
131
132 $ chg crash --pager=on --config ui.formatted=True 2>/dev/null
133 crash-pager: going to crash
134 [255]
135
105 $ cd ..
136 $ cd ..
106
137
107 server lifecycle
138 server lifecycle
General Comments 0
You need to be logged in to leave comments. Login now