Added better signal name lookup

main
Tom Wallis 9 years ago
parent 07adca6ca3
commit 89a380ef4b

@ -60,12 +60,16 @@ _signames = dict((getattr(signal, signame), signame)
def signal_name(signum):
# Hackety-hack-hack: is there really no better way to reverse lookup the
# signal name? If you read this and know a way: please provide a patch :)
try:
if sys.version_info[:2] >= (3, 5):
return signal.Signals(signum).name
else:
return _signames[signum]
except KeyError:
return 'SIG_UNKNOWN'
except ValueError:
return 'SIG_UNKNOWN'
WorkerStatus = enum(

Loading…
Cancel
Save