Commit 94e6323206b42cb7c086edd25ec15d6cea672de8

Authored by m-holger
1 parent 0046de08

Fix exit code when an input other than the primary input generates warnings

libqpdf/QPDFJob.cc
... ... @@ -477,6 +477,12 @@ QPDFJob::createQPDF()
477 477 }
478 478 handleUnderOverlay(pdf);
479 479 handleTransformations(pdf);
  480 +
  481 + for (auto& foreign: page_heap) {
  482 + if (foreign->anyWarnings()) {
  483 + m->warnings = true;
  484 + }
  485 + }
480 486 return pdf_sp;
481 487 }
482 488  
... ...
qpdf/qtest/page-errors.test
... ... @@ -22,7 +22,7 @@ $td->runtest("handle page no with contents",
22 22 $td->NORMALIZE_NEWLINES);
23 23 $td->runtest("handle page with missing MediaBox",
24 24 {$td->COMMAND => "qpdf --static-id --empty --pages page-no-content.pdf -- out.pdf"},
25   - {$td->FILE => "page-missing-mediabox.out", $td->EXIT_STATUS => 0},
  25 + {$td->FILE => "page-missing-mediabox.out", $td->EXIT_STATUS => 3},
26 26 $td->NORMALIZE_NEWLINES);
27 27 $td->runtest("check output",
28 28 {$td->FILE => "out.pdf"},
... ...
qpdf/qtest/qpdf/page-missing-mediabox.out
1 1 WARNING: page-no-content.pdf, object 4 0 at offset 288: kid 1 (from 0) MediaBox is undefined; setting to letter / ANSI A
  2 +qpdf: operation succeeded with warnings; resulting file may have some problems
... ...