##// END OF EJS Templates
tests: stabilize test-fix.t on Windows...
tests: stabilize test-fix.t on Windows `pwd` prints /tmp/... style paths, not C:\... needed for $TESTTMP to be substituted. In the final test, for whatever reason, Windows was missing EOL in the files and printing: [wdir] changedlines: printf: warning: ignoring excess arguments, starting with 'printf' even though it was trying to run: printf "Line ranges:\n"; printf "2 through 2\n"; I tried wrapping both :command and :linerange in `sh -c "..."`, and while that fixed the missing EOL, it missed the "2 through 2" output. Differential Revision: https://phab.mercurial-scm.org/D6852

File last commit:

r41689:6dae1f31 default
r43208:a2dffe68 default
Show More
showstack.py
28 lines | 731 B | text/x-python | PythonLexer
Matt Mackall
contrib: add showstack extension...
r26123 # showstack.py - extension to dump a Python stack trace on signal
#
# binds to both SIGQUIT (Ctrl-\) and SIGINFO (Ctrl-T on BSDs)
Gregory Szorc
showstack: use raw docstring...
r41689 r"""dump stack trace when receiving SIGQUIT (Ctrl-\) or SIGINFO (Ctrl-T on BSDs)
Boris Feld
showstack: add an extension docstring...
r35674 """
Matt Mackall
contrib: add showstack extension...
r26123
Augie Fackler
showstack: also handle SIGALRM...
r40072 from __future__ import absolute_import, print_function
Pulkit Goyal
showstack: use absolute_import
r28522 import signal
import sys
import traceback
Matt Mackall
contrib: add showstack extension...
r26123
def sigshow(*args):
sys.stderr.write("\n")
traceback.print_stack(args[1], limit=10, file=sys.stderr)
sys.stderr.write("----\n")
Augie Fackler
showstack: also handle SIGALRM...
r40072 def sigexit(*args):
sigshow(*args)
print('alarm!')
sys.exit(1)
Matt Mackall
contrib: add showstack extension...
r26123 def extsetup(ui):
signal.signal(signal.SIGQUIT, sigshow)
Augie Fackler
showstack: also handle SIGALRM...
r40072 signal.signal(signal.SIGALRM, sigexit)
Matt Mackall
contrib: add showstack extension...
r26123 try:
signal.signal(signal.SIGINFO, sigshow)
except AttributeError:
pass