Skip to content

Commit

Permalink
return with non-zero exit status on error
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Oct 27, 2019
1 parent c887493 commit 03e0cec
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
7 changes: 3 additions & 4 deletions bin/gallery-dl
Original file line number Diff line number Diff line change
@@ -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())
10 changes: 7 additions & 3 deletions gallery_dl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,24 +234,28 @@ 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)
if isinstance(url, util.ExtendedUrl):
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
4 changes: 2 additions & 2 deletions gallery_dl/__main__.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -17,4 +17,4 @@
import gallery_dl

if __name__ == "__main__":
gallery_dl.main()
sys.exit(gallery_dl.main())

0 comments on commit 03e0cec

Please sign in to comment.