Commit dfe60f81 authored by Vincent Pelletier's avatar Vincent Pelletier

Fix traceback module use, and factorise code.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2062 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent b9859fa8
...@@ -38,23 +38,24 @@ ENABLED = False ...@@ -38,23 +38,24 @@ ENABLED = False
# SIGUSR2: # SIGUSR2:
# Triggers a pdb prompt on process' controlling TTY. # Triggers a pdb prompt on process' controlling TTY.
def decorate(func):
def decorator(sig, frame):
try:
func(sig, frame)
except:
# Prevent exception from exiting signal handler, so mistakes in
# "debug" module don't kill process.
traceback.print_exc()
@decorate
def debugHandler(sig, frame): def debugHandler(sig, frame):
try: file, filename, (suffix, mode, type) = imp.find_module('debug',
file, filename, (suffix, mode, type) = imp.find_module('debug', neo.__path__)
neo.__path__) imp.load_module('neo.debug', file, filename, (suffix, mode, type))
imp.load_module('neo.debug', file, filename, (suffix, mode, type))
except:
# Prevent exception from exiting signal handler, so mistakes in
# "debug" module don't kill process.
traceback.print_exception()
@decorate
def pdbHandler(sig, frame): def pdbHandler(sig, frame):
try: pdb.set_trace()
pdb.set_trace()
except:
# Prevent exception from exiting signal handler, so mistakes in
# pdb don't kill process.
traceback.print_exception()
def register(): def register():
if ENABLED: if ENABLED:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment