Skip to content
This repository has been archived by the owner on Jul 25, 2023. It is now read-only.

Commit

Permalink
take returncode into account
Browse files Browse the repository at this point in the history
  • Loading branch information
Stijn Vannieuwenhuyse committed Jul 31, 2014
1 parent 5b84d6d commit 1a5cfb3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/PhpPdftkManipulators/PdfCombiner.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,12 @@ public function concatenateFromFilePaths($sourceFilePaths)
$outputFile = tempnam(sys_get_temp_dir(), 'pdf');

$command = sprintf("{$this->pdftkBinary} %s cat output $outputFile", implode(' ', $sourceFilePaths));
exec($command);
exec($command, $output, $returnCode);

if($returnCode != 0) {
throw \RuntimeException("Couldn't catenate PDFs");
}

$result = file_get_contents($outputFile);
if(!$result) {
throw new \RuntimeException("Couldn't catenate PDFs");
Expand All @@ -85,4 +90,4 @@ public function concatenateFromFilePaths($sourceFilePaths)
@unlink($outputFile);
return $result;
}
}
}

0 comments on commit 1a5cfb3

Please sign in to comment.