Skip to content

Commit

Permalink
Make booksort return non-zero if there were unparsable files
Browse files Browse the repository at this point in the history
  • Loading branch information
vbwagner committed Oct 30, 2020
1 parent 34bfb4a commit 17a68f8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion booksort
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ def handle_file(infilename, needzip=False, move=False, simulate=False,
mode="w",
compression=zipfile.ZIP_DEFLATED,
compresslevel=9)
# strip .zip extnesion from archive member
# strip .zip extnesion from archive member
outfile = zipf.open(filename[:-4], mode="w")
else:
zipf = None
Expand Down Expand Up @@ -375,6 +375,7 @@ def main():
print("Options --move and --simulate cannod be used together\n",
file=sys.stderr)
sys.exit(1)
failures = 0
for param in files:
try:
handle_file(param, **opts)
Expand All @@ -386,5 +387,10 @@ def main():
if opts["verbose"]:
import traceback
traceback.print_tb(info[2])
failures += 1
if failures:
print("%d file(s) were unparsable" % failures, file=sys.stderr)
sys.exit(2)

if __name__ == "__main__":
main()

0 comments on commit 17a68f8

Please sign in to comment.