dispatch: ignore further SIGPIPE while handling KeyboardInterrupt
I got the following error by running "hg log" and quitting the pager
immediately. Any output here may trigger another SIGPIPE, so only thing
we can do is to swallow the exception and exit with an error status.
Traceback (most recent call last):
File "./hg", line 45, in <module>
mercurial.dispatch.run()
File "mercurial/dispatch.py", line 83, in run
status = (dispatch(req) or 0) & 255
File "mercurial/dispatch.py", line 167, in dispatch
req.ui.warn(_("interrupted!\n"))
File "mercurial/ui.py", line 1224, in warn
self.write_err(*msg, **opts)
File "mercurial/ui.py", line 790, in write_err
self._write_err(*msgs, **opts)
File "mercurial/ui.py", line 798, in _write_err
self.ferr.write(a)
File "mercurial/ui.py", line 129, in _catchterm
raise error.SignalInterrupt
mercurial.error.SignalInterrupt
Perhaps this wasn't visible before
de5c9d0e02ea because the original stderr
handle was restored very late.
worker: print traceback for uncaught exception unconditionally
This is what a Python interpreter would do if there were no os._exit().
worker: propagate exit code to main process
Follows up
86cd09bc13ba.
dispatch: print traceback in scmutil.callcatch() if --traceback specified
Otherwise, traceback wouldn't be printed for a known exception occurred in
worker processes.
templatefilters: fix crash by string formatting of '{x|splitlines}'
Before, it crashed because mapping['templ'] was missing. As it didn't support
the legacy list template from the beginning, we can simply use hybridlist().
templatekw: factor out showdict() helper
Make it less cryptic for common cases.
templatekw: have showlist() take mapping dict with no **kwargs expansion (API)
See the previous commit for why.
splitlines() does not pass a mapping dict, which would probably mean the
legacy template didn't work from the beginning.
templatekw: change _showlist() to take mapping dict with no **kwargs expansion
There was a risk that a template keyword could conflict with an argument
name (e.g. 'name', 'values', 'plural', etc.) Let's make it less magical.
templatekw: rename 'args' to 'mapping' in showlist()
The name 'args' provides no information. Call it 'mapping' as in templater.py.