##// END OF EJS Templates
showstack: add an extension docstring...
Boris Feld -
r35674:c9eb92fb default
parent child Browse files
Show More
@@ -1,20 +1,22 b''
1 # showstack.py - extension to dump a Python stack trace on signal
1 # showstack.py - extension to dump a Python stack trace on signal
2 #
2 #
3 # binds to both SIGQUIT (Ctrl-\) and SIGINFO (Ctrl-T on BSDs)
3 # binds to both SIGQUIT (Ctrl-\) and SIGINFO (Ctrl-T on BSDs)
4 """dump stack trace when receiving SIGQUIT (Ctrl-\) and SIGINFO (Ctrl-T on BSDs)
5 """
4
6
5 from __future__ import absolute_import
7 from __future__ import absolute_import
6 import signal
8 import signal
7 import sys
9 import sys
8 import traceback
10 import traceback
9
11
10 def sigshow(*args):
12 def sigshow(*args):
11 sys.stderr.write("\n")
13 sys.stderr.write("\n")
12 traceback.print_stack(args[1], limit=10, file=sys.stderr)
14 traceback.print_stack(args[1], limit=10, file=sys.stderr)
13 sys.stderr.write("----\n")
15 sys.stderr.write("----\n")
14
16
15 def extsetup(ui):
17 def extsetup(ui):
16 signal.signal(signal.SIGQUIT, sigshow)
18 signal.signal(signal.SIGQUIT, sigshow)
17 try:
19 try:
18 signal.signal(signal.SIGINFO, sigshow)
20 signal.signal(signal.SIGINFO, sigshow)
19 except AttributeError:
21 except AttributeError:
20 pass
22 pass
General Comments 0
You need to be logged in to leave comments. Login now