-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix opening pdf with okular in linux (#5253) #5855
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,11 @@ public void openFile(String filePath, String fileType) throws IOException { | |
viewer = "xdg-open"; | ||
} | ||
String[] cmdArray = { viewer, filePath }; | ||
Runtime.getRuntime().exec(cmdArray); | ||
Process p; | ||
p = Runtime.getRuntime().exec(cmdArray); | ||
BufferedReader in = new BufferedReader(new InputStreamReader(p.getErrorStream())); | ||
String line; | ||
line = in.readLine(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As @calixtus said, it would be nice if you could add a logging statement here: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK. I have done the modifications. I had to add also the lines There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You just commit the changes on your branch and then push them to your fork. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK. That is done. Thank you for your help! |
||
} | ||
|
||
@Override | ||
|
@@ -46,7 +50,11 @@ 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; | ||
p = Runtime.getRuntime().exec(cmdArray); | ||
BufferedReader in = new BufferedReader(new InputStreamReader(p.getErrorStream())); | ||
String line; | ||
line = in.readLine(); | ||
} | ||
|
||
@Override | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In java you don't need to declare and assign variables separately. So the following works (and is slightly preferred):