my most commonly used signal handler, great for getting at anything that has an infinite loop (intentional or not)

This commit is contained in:
Mahmoud Hashemi 2014-03-01 12:51:41 -08:00
parent af6b04531e
commit 8d022898d7
1 changed files with 14 additions and 0 deletions

14
boltons/debugutils.py Normal file
View File

@ -0,0 +1,14 @@
# -*- coding: utf-8 -*-
def pdb_on_signal(signal=None):
import pdb
import signal
if not signal:
signal = signal.SIGINT
def pdb_int_handler(sig, frame):
pdb.set_trace()
signal.signal(signal.SIGINT, pdb_int_handler)
return