1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-21 18:22:30 +01:00

return with non-zero exit status on error

This commit is contained in:
Mike Fährmann 2019-10-27 23:34:52 +01:00
parent c887493a80
commit 03e0cec715
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
3 changed files with 12 additions and 9 deletions

View File

@ -1,7 +1,6 @@
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
# -*- coding: utf-8 -*-
import sys
import gallery_dl
if __name__ == '__main__':
gallery_dl.main()
sys.exit(gallery_dl.main())

View File

@ -234,6 +234,7 @@ def main():
if pformat and len(urls) > 1 and args.loglevel < logging.ERROR:
urls = progress(urls, pformat)
retval = 0
for url in urls:
try:
log.debug("Starting %s for '%s'", jobtype.__name__, url)
@ -241,17 +242,20 @@ def main():
for key, value in url.gconfig:
config.set(key, value)
with config.apply(url.lconfig):
jobtype(url.value).run()
retval |= jobtype(url.value).run()
else:
jobtype(url).run()
retval |= jobtype(url).run()
except exception.NoExtractorError:
log.error("No suitable extractor found for '%s'", url)
retval |= 128
return retval
except KeyboardInterrupt:
sys.exit("\nKeyboardInterrupt")
except BrokenPipeError:
pass
except IOError as exc:
except OSError as exc:
import errno
if exc.errno != errno.EPIPE:
raise
return 1

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2017 Mike Fährmann
# Copyright 2017-2019 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__":
gallery_dl.main()
sys.exit(gallery_dl.main())