mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-22 02:32:33 +01:00
return with non-zero exit status on error
This commit is contained in:
parent
c887493a80
commit
03e0cec715
@ -1,7 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: UTF-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import sys
|
||||||
import gallery_dl
|
import gallery_dl
|
||||||
|
sys.exit(gallery_dl.main())
|
||||||
if __name__ == '__main__':
|
|
||||||
gallery_dl.main()
|
|
||||||
|
@ -234,6 +234,7 @@ def main():
|
|||||||
if pformat and len(urls) > 1 and args.loglevel < logging.ERROR:
|
if pformat and len(urls) > 1 and args.loglevel < logging.ERROR:
|
||||||
urls = progress(urls, pformat)
|
urls = progress(urls, pformat)
|
||||||
|
|
||||||
|
retval = 0
|
||||||
for url in urls:
|
for url in urls:
|
||||||
try:
|
try:
|
||||||
log.debug("Starting %s for '%s'", jobtype.__name__, url)
|
log.debug("Starting %s for '%s'", jobtype.__name__, url)
|
||||||
@ -241,17 +242,20 @@ def main():
|
|||||||
for key, value in url.gconfig:
|
for key, value in url.gconfig:
|
||||||
config.set(key, value)
|
config.set(key, value)
|
||||||
with config.apply(url.lconfig):
|
with config.apply(url.lconfig):
|
||||||
jobtype(url.value).run()
|
retval |= jobtype(url.value).run()
|
||||||
else:
|
else:
|
||||||
jobtype(url).run()
|
retval |= jobtype(url).run()
|
||||||
except exception.NoExtractorError:
|
except exception.NoExtractorError:
|
||||||
log.error("No suitable extractor found for '%s'", url)
|
log.error("No suitable extractor found for '%s'", url)
|
||||||
|
retval |= 128
|
||||||
|
return retval
|
||||||
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
sys.exit("\nKeyboardInterrupt")
|
sys.exit("\nKeyboardInterrupt")
|
||||||
except BrokenPipeError:
|
except BrokenPipeError:
|
||||||
pass
|
pass
|
||||||
except IOError as exc:
|
except OSError as exc:
|
||||||
import errno
|
import errno
|
||||||
if exc.errno != errno.EPIPE:
|
if exc.errno != errno.EPIPE:
|
||||||
raise
|
raise
|
||||||
|
return 1
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- 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
|
# 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
|
# 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
|
import gallery_dl
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
gallery_dl.main()
|
sys.exit(gallery_dl.main())
|
||||||
|
Loading…
Reference in New Issue
Block a user