14 msg = logging.getLogger(__name__)
16 _savedSignalHandlerDict = {}
22 _defaultSignalList = [
'SIGABRT',
'SIGFPE',
'SIGBUS',
'SIGHUP',
'SIGILL',
'SIGIO',
'SIGPIPE',
'SIGQUIT',
'SIGSEGV',
'SIGSYS',
'SIGXCPU',
'SIGXFSZ']
29 for s
in _defaultSignalList:
31 msg.debug(
"Setting signalhandler for %s to %s", s, handler)
32 _savedSignalHandlerDict[s] = signal.signal(getattr(signal, s), handler)
33 except Exception
as e:
34 msg.error(
"Unable to attach custom signal handler to %s: %s", s, e)
41 for s
in _defaultSignalList:
43 signal.signal(getattr(signal, s), _savedSignalHandlerDict.get(s, signal.SIG_DFL))
44 except Exception
as e:
45 msg.error(
"Unable to attach custom signal handler to %s: %s", s, e)