Show More
@@ -0,0 +1,17 b'' | |||||
|
1 | # showstack.py - extension to dump a Python stack trace on signal | |||
|
2 | # | |||
|
3 | # binds to both SIGQUIT (Ctrl-\) and SIGINFO (Ctrl-T on BSDs) | |||
|
4 | ||||
|
5 | import sys, signal, traceback | |||
|
6 | ||||
|
7 | def sigshow(*args): | |||
|
8 | sys.stderr.write("\n") | |||
|
9 | traceback.print_stack(args[1], limit=10, file=sys.stderr) | |||
|
10 | sys.stderr.write("----\n") | |||
|
11 | ||||
|
12 | def extsetup(ui): | |||
|
13 | signal.signal(signal.SIGQUIT, sigshow) | |||
|
14 | try: | |||
|
15 | signal.signal(signal.SIGINFO, sigshow) | |||
|
16 | except AttributeError: | |||
|
17 | pass |
General Comments 0
You need to be logged in to leave comments.
Login now