1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 10:42:34 +01:00

'sys.exit' -> 'SystemExit'

This commit is contained in:
Mike Fährmann 2023-08-21 23:46:39 +02:00
parent 410f783a33
commit 92f98e6f5e
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
6 changed files with 9 additions and 11 deletions

View File

@ -297,7 +297,7 @@ def main():
return retval
except KeyboardInterrupt:
sys.exit("\nKeyboardInterrupt")
raise SystemExit("\nKeyboardInterrupt")
except BrokenPipeError:
pass
except OSError as exc:

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2017-2019 Mike Fährmann
# Copyright 2017-2023 Mike Fährmann
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
@ -17,4 +17,4 @@ if __package__ is None and not hasattr(sys, "frozen"):
import gallery_dl
if __name__ == "__main__":
sys.exit(gallery_dl.main())
raise SystemExit(gallery_dl.main())

View File

@ -9,7 +9,6 @@
""" """
import re
import sys
import logging
import operator
from . import util, exception
@ -98,7 +97,7 @@ def action_exit(opts):
pass
def _exit(args):
sys.exit(opts)
raise SystemExit(opts)
return _exit

View File

@ -100,12 +100,12 @@ def load(files=None, strict=False, loads=util.json_loads):
except OSError as exc:
if strict:
log.error(exc)
sys.exit(1)
raise SystemExit(1)
except Exception as exc:
log.error("%s when loading '%s': %s",
exc.__class__.__name__, path, exc)
if strict:
sys.exit(2)
raise SystemExit(2)
else:
if not _config:
_config.update(conf)

View File

@ -515,7 +515,7 @@ class DownloadJob(Job):
elif skip == "terminate":
self._skipexc = exception.TerminateExtraction
elif skip == "exit":
self._skipexc = sys.exit
self._skipexc = SystemExit
self._skipmax = text.parse_int(smax)
else:
# monkey-patch methods to always return False

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright 2020-2021 Mike Fährmann
# Copyright 2020-2023 Mike Fährmann
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
@ -10,7 +10,6 @@
from .common import PostProcessor
from .. import text, util, exception
import sys
import os
@ -31,7 +30,7 @@ class ComparePP(PostProcessor):
elif equal == "terminate":
self._equal_exc = exception.TerminateExtraction
elif equal == "exit":
self._equal_exc = sys.exit
self._equal_exc = SystemExit
job.register_hooks({"file": (
self.enumerate