Skip to content
Permalink
Browse files

Improve UI when `pelican --listen` web server is quit (#2684)

Improve UI when `pelican --listen` web server is quit
  • Loading branch information
justinmayer committed Jan 20, 2020
2 parents 70c8d2a + fa71931 commit cf96c113e1f521a85372f81c0d4d5a6dada941ca
Showing with 6 additions and 1 deletion.
  1. +6 −1 pelican/__init__.py
@@ -466,14 +466,19 @@ def listen(server, port, output, excqueue=None):
excqueue.put(traceback.format_exception_only(type(e), e)[-1])
return

logging.info("Serving at port %s, server %s.", port, server)
try:
print("\nServing site at: {}:{} - Tap CTRL-C to stop".format(
server, port))
httpd.serve_forever()
except Exception as e:
if excqueue is not None:
excqueue.put(traceback.format_exception_only(type(e), e)[-1])
return

except KeyboardInterrupt:
print("\nKeyboard interrupt received. Shutting down server.")
httpd.socket.close()


def main(argv=None):
args = parse_arguments(argv)

0 comments on commit cf96c11

Please sign in to comment.
You can’t perform that action at this time.