Skip to content

Commit

Permalink
Update Ghoscript version 10 support
Browse files Browse the repository at this point in the history
  • Loading branch information
jeortizquan committed Aug 2, 2024
1 parent 05d5e91 commit f6daea0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ static String discoverGhostScriptCommand(CommandExecutor commandExecutor)
final String output;
output = commandExecutor.execute(Arrays.asList(command, "--version"), emptyMap(), true, message ->
new MediaProcessorException("Error while looking for ghostscript tools: " + message));
if (!output.startsWith("9.")) {
throw new MediaProcessorException("Ghostscript 9.x not found.");
if (!(output.startsWith("10.") || output.startsWith("9."))) {
throw new MediaProcessorException("Ghostscript 10.x or 9.x not found.");
}

// So it is installed and available.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ void testDiscoverGhostScriptCommand() throws MediaProcessorException {
final String ghostScriptCommand = "gs";
final List<String> ghostScriptVersionCommand = Arrays.asList(ghostScriptCommand, "--version");

// Test right version
doReturn("10.02").when(commandExecutor)
.execute(eq(ghostScriptVersionCommand), anyMap(), eq(true), any());
assertEquals(ghostScriptCommand,
PdfToImageConverter.discoverGhostScriptCommand(commandExecutor));

// Test right version
doReturn("9.26").when(commandExecutor)
.execute(eq(ghostScriptVersionCommand), anyMap(), eq(true), any());
Expand Down

0 comments on commit f6daea0

Please sign in to comment.