diff --git a/CHANGELOG.md b/CHANGELOG.md index 62fca1b2de1..5f258dd514d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# ### Fixed +- We fixed and issue where pdf files will not open under some KDE linux distributions when using okular. [#5253](https://github.com/JabRef/jabref/issues/5253) - We fixed an issue where the Medline fetcher was only working when JabRef was running from source. [#5645](https://github.com/JabRef/jabref/issues/5645) - We fixed some visual issues in the dark theme. [#5764](https://github.com/JabRef/jabref/pull/5764) [#5753](https://github.com/JabRef/jabref/issues/5753) - We fixed an issue where non-default previews didn't handle unicode characters. [#5779](https://github.com/JabRef/jabref/issues/5779) diff --git a/src/main/java/org/jabref/gui/desktop/os/Linux.java b/src/main/java/org/jabref/gui/desktop/os/Linux.java index dd45135a6b1..a39c6e335d2 100644 --- a/src/main/java/org/jabref/gui/desktop/os/Linux.java +++ b/src/main/java/org/jabref/gui/desktop/os/Linux.java @@ -15,10 +15,15 @@ import org.jabref.gui.externalfiletype.ExternalFileTypes; import org.jabref.preferences.JabRefPreferences; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import static org.jabref.preferences.JabRefPreferences.ADOBE_ACROBAT_COMMAND; import static org.jabref.preferences.JabRefPreferences.USE_PDF_READER; public class Linux implements NativeDesktop { + private static final Logger LOGGER = LoggerFactory.getLogger(Linux.class); + @Override public void openFile(String filePath, String fileType) throws IOException { Optional type = ExternalFileTypes.getInstance().getExternalFileTypeByExt(fileType); @@ -30,7 +35,13 @@ public void openFile(String filePath, String fileType) throws IOException { viewer = "xdg-open"; } String[] cmdArray = { viewer, filePath }; - Runtime.getRuntime().exec(cmdArray); + Process p = Runtime.getRuntime().exec(cmdArray); + // When the stream is full at some point, then blocks the execution of the program + // See https://stackoverflow.com/questions/10981969/why-is-going-through-geterrorstream-necessary-to-run-a-process. + BufferedReader in = new BufferedReader(new InputStreamReader(p.getErrorStream())); + String line; + line = in.readLine(); + LOGGER.debug("Received output: " + line); } @Override @@ -46,7 +57,13 @@ public void openFileWithApplication(String filePath, String application) throws String[] cmdArray = new String[openWith.length + 1]; System.arraycopy(openWith, 0, cmdArray, 0, openWith.length); cmdArray[cmdArray.length - 1] = filePath; - Runtime.getRuntime().exec(cmdArray); + Process p = Runtime.getRuntime().exec(cmdArray); + // When the stream is full at some point, then blocks the execution of the program + // See https://stackoverflow.com/questions/10981969/why-is-going-through-geterrorstream-necessary-to-run-a-process. + BufferedReader in = new BufferedReader(new InputStreamReader(p.getErrorStream())); + String line; + line = in.readLine(); + LOGGER.debug("Received output: " + line); } @Override