##// END OF EJS Templates
tests: allow the true command to be provided by coreutils...
tests: allow the true command to be provided by coreutils The `true` command is sometimes provided as a symbolic link to the `coreutils` single binary. This is the case on NixOS, on which the test was failing because the symbolic link fully resolves to the latter name, equally valid but not previously accepted by the test's golden output. Differential Revision: https://phab.mercurial-scm.org/D11740

File last commit:

r43346:2372284d default
r49134:bc04a761 stable
Show More
showstack.py
31 lines | 734 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
Augie Fackler
formatting: blacken the codebase...
r43346
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
formatting: blacken the codebase...
r43346
Augie Fackler
showstack: also handle SIGALRM...
r40072 def sigexit(*args):
sigshow(*args)
print('alarm!')
sys.exit(1)
Augie Fackler
formatting: blacken the codebase...
r43346
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