Skip to content

Commit

Permalink
Exit program more gracefully on keyboard interrupt
Browse files Browse the repository at this point in the history
  • Loading branch information
clpo13 committed Nov 17, 2023
1 parent 2965c31 commit 0c93e4a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/wikiget/wikiget.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,5 +138,10 @@ def cli() -> None:
logger.info("Starting download session using wikiget %s", wikiget.__version__)
logger.debug("User agent: %s", wikiget.USER_AGENT)

exit_code = process_download(args)
sys.exit(exit_code)
try:
exit_code = process_download(args)
except KeyboardInterrupt:
logger.critical("Interrupted by user")
exit_code = 130
finally:
sys.exit(exit_code)

0 comments on commit 0c93e4a

Please sign in to comment.