aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/wikiget/dl.py3
-rw-r--r--src/wikiget/wikiget.py5
2 files changed, 3 insertions, 5 deletions
diff --git a/src/wikiget/dl.py b/src/wikiget/dl.py
index 85c6685..5a6ef0b 100644
--- a/src/wikiget/dl.py
+++ b/src/wikiget/dl.py
@@ -20,7 +20,6 @@
from __future__ import annotations
import logging
-import sys
from concurrent.futures import ThreadPoolExecutor
from typing import TYPE_CHECKING
@@ -134,7 +133,7 @@ def batch_download(args: Namespace) -> int:
dl_dict = read_batch_file(args.FILE)
except OSError as e:
logger.error("File could not be read: %s", str(e))
- sys.exit(1)
+ return 1
with ThreadPoolExecutor(max_workers=args.threads) as executor:
futures = []
diff --git a/src/wikiget/wikiget.py b/src/wikiget/wikiget.py
index 152953c..0a6478e 100644
--- a/src/wikiget/wikiget.py
+++ b/src/wikiget/wikiget.py
@@ -129,7 +129,7 @@ def parse_args(argv: list[str]) -> argparse.Namespace:
return parser.parse_args(argv)
-def cli() -> None:
+def cli() -> int:
"""Set up the command-line environment and start the download process."""
args = parse_args(sys.argv[1:])
configure_logging(verbosity=args.verbose, logfile=args.logfile, quiet=args.quiet)
@@ -146,5 +146,4 @@ def cli() -> None:
except KeyboardInterrupt:
logger.critical("Interrupted by user")
exit_code = 130
- finally:
- sys.exit(exit_code)
+ return exit_code