mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Exit web server gracefully when user taps CTRL-C
Users were previously met with an ugly traceback. Now `pelican --listen` invocations, when quit via CTRL-C, are followed instead by a more user-friendly message.
This commit is contained in:
parent
569f8a080e
commit
fa71931503
1 changed files with 4 additions and 0 deletions
|
|
@ -475,6 +475,10 @@ def listen(server, port, output, excqueue=None):
|
||||||
excqueue.put(traceback.format_exception_only(type(e), e)[-1])
|
excqueue.put(traceback.format_exception_only(type(e), e)[-1])
|
||||||
return
|
return
|
||||||
|
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print("\nKeyboard interrupt received. Shutting down server.")
|
||||||
|
httpd.socket.close()
|
||||||
|
|
||||||
|
|
||||||
def main(argv=None):
|
def main(argv=None):
|
||||||
args = parse_arguments(argv)
|
args = parse_arguments(argv)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue