aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xserver.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/server.py b/server.py
index 9fa7530..c0b8fc5 100755
--- a/server.py
+++ b/server.py
@@ -59,6 +59,11 @@ def handle_sigterm(signum, frame):
set_exiting()
+def handle_sigint():
+ print('\nKeyboard interrupt received, exiting...')
+ set_exiting()
+
+
@contextmanager
def setup_signal_handlers(httpd):
handler_thread = SignalHandler(httpd)
@@ -119,8 +124,7 @@ def main(args=None):
try:
httpd.serve_forever()
except KeyboardInterrupt:
- print('\nKeyboard interrupt received, exiting...')
- set_exiting()
+ handle_sigint()
if __name__ == '__main__':