diff options
| author | Danilo M. <danix@danix.xyz> | 2026-10-07 11:54:40 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-10-07 11:54:40 +0200 |
| commit | b19ab4fe32aa30e68235e7b66b419bf222af66a3 (patch) | |
| tree | 54a587ab9d69717bc6416fb60b01eb07e95d6430 | |
| parent | 880d458e31baf1eceb3ae62bb69fdc56332d1558 (diff) | |
| download | bunkr_dl-b19ab4fe32aa30e68235e7b66b419bf222af66a3.tar.gz bunkr_dl-b19ab4fe32aa30e68235e7b66b419bf222af66a3.zip | |
Exit cleanly on Ctrl+C
KeyboardInterrupt escaped main() and dumped a traceback. Catch it at
the entry point, tell the user a rerun resumes the partial file, and
exit with status 130.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| -rwxr-xr-x | bunkr_dl | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -20,6 +20,7 @@ import requests from bs4 import BeautifulSoup import re import os +import sys import argparse import time from urllib.parse import urljoin, urlparse, quote @@ -273,4 +274,9 @@ def main(): process_album(url, save_directory) if __name__ == "__main__": - main() + try: + main() + except KeyboardInterrupt: + # Partial file stays on disk; rerunning the same command resumes it + print("\nInterrupted. Rerun the same command to resume.") + sys.exit(130) |
