Merge pull request #722 from probablytom/master

Added better signal name lookup
main
Selwin Ong 9 years ago committed by GitHub
commit 11f9833816

@ -60,12 +60,16 @@ _signames = dict((getattr(signal, signame), signame)
def signal_name(signum): 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: try:
return _signames[signum] if sys.version_info[:2] >= (3, 5):
return signal.Signals(signum).name
else:
return _signames[signum]
except KeyError: except KeyError:
return 'SIG_UNKNOWN' return 'SIG_UNKNOWN'
except ValueError:
return 'SIG_UNKNOWN'
WorkerStatus = enum( WorkerStatus = enum(

Loading…
Cancel
Save