aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2018-10-09 18:06:54 +0300
committerFilipp Lepalaan <filipp@mac.com>2018-10-09 18:06:54 +0300
commit1c6b35652e8d71c5e22502f44df9079734a138bf (patch)
treeeb926ada64e980ac169de430a8d7606e2129ee92
parente6056c56316bb38eed69c366e346f1eeae979b9b (diff)
downloadgsx-mockserver-1c6b35652e8d71c5e22502f44df9079734a138bf.tar.gz
gsx-mockserver-1c6b35652e8d71c5e22502f44df9079734a138bf.tar.bz2
gsx-mockserver-1c6b35652e8d71c5e22502f44df9079734a138bf.zip
Fix: add ctrl-c handler
-rwxr-xr-xserve.py6
1 files changed, 5 insertions, 1 deletions
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()