listen: handle KeyboardInterrupt

Current response to Ctrl+C with "pelican --listen" is to bail with an
exception.

Instead, exit proper and show a message.

Fixes #2676
This commit is contained in:
Steven Penny 2020-01-14 22:41:38 -06:00
commit e23af21b21

View file

@ -474,6 +474,9 @@ def listen(server, port, output, excqueue=None):
excqueue.put(traceback.format_exception_only(type(e), e)[-1])
return
except KeyboardInterrupt:
logger.info("Shutting down server.")
httpd.socket.close()
def main(argv=None):
args = parse_arguments(argv)