Merge pull request #34 from shemgp/master

Don't exit when qpdf repairs the file successfully but displays warning
This commit is contained in:
jbarlow83
2015-12-16 20:46:47 -08:00
+7 -1
View File
@@ -356,14 +356,20 @@ def repair_pdf(
try:
out = check_output(args_qpdf, stderr=STDOUT, universal_newlines=True)
except CalledProcessError as e:
exit_with_error = True
if e.returncode == 2:
print("{0}: not a valid PDF, and could not repair it.".format(
options.input_file))
print("Details:")
print(e.output)
elif e.returncode == 3 and e.output.find("operation succeeded"):
exit_with_error = False
out = e.output
print(e.output)
else:
print(e.output)
sys.exit(ExitCode.input_file)
if exit_with_error:
sys.exit(ExitCode.input_file)
log.debug(out)