From 1c6b35652e8d71c5e22502f44df9079734a138bf Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Tue, 9 Oct 2018 18:06:54 +0300 Subject: Fix: add ctrl-c handler --- serve.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/serve.py b/serve.py index 2958968..be8c047 100755 --- a/serve.py +++ b/serve.py @@ -78,4 +78,8 @@ if __name__ == '__main__': with HTTPServer((args.address, args.port), Handler) as httpd: print('GSX mock server serving on http://%s:%d' % (args.address, args.port)) - httpd.serve_forever() + try: + httpd.serve_forever() + except KeyboardInterrupt: + print('GSX mock server shutting down...') + httpd.shutdown() -- cgit v1.2.3