Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+23
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Created on Fri Dec 11 13:44:45 2020
|
||||
|
||||
@author: Filip Biedziak
|
||||
"""
|
||||
|
||||
import sys
|
||||
import signal
|
||||
|
||||
|
||||
class SignalHandler(object):
|
||||
|
||||
def __init__(self, socket):
|
||||
self._socket = socket
|
||||
signal.signal(signal.SIGINT, self.onSigint)
|
||||
|
||||
def onSigint(self, s, f):
|
||||
"""Handler to gracefully exit on Ctrl+C."""
|
||||
print("\nCtrl+C pressed")
|
||||
self._socket.close()
|
||||
sys.exit(0)
|
||||
Reference in new issue
Block a user