Skip to content

Commit

Permalink
Wait for process termination
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasblaesing committed Mar 14, 2020
1 parent 680bf06 commit 3e960b3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Features
* [#1160](https://github.com/java-native-access/jna/issues/1160): Make FileUtils#moveToTrash a varargs method - [@matthiasblaesing](https://github.com/matthiasblaesing).
* [#1167](https://github.com/java-native-access/jna/pull/1167): Add `c.s.j.p.win32.Kernel32.GetProcessAffinityMask` - [@dbwiddis](https://github.com/dbwiddis).
* [#1168](https://github.com/java-native-access/jna/pull/1168): Add `c.s.j.p.win32.Kernel32.SetProcessAffinityMask` - [@dbwiddis](https://github.com/dbwiddis).
* [#1169](https://github.com/java-native-access/jna/issues/1169): Wait for process in getLinuxLdPaths - [@rdesgroppes](https://github.com/rdesgroppes).

Bug Fixes
---------
Expand Down
9 changes: 8 additions & 1 deletion src/com/sun/jna/NativeLibrary.java
Original file line number Diff line number Diff line change
Expand Up @@ -987,9 +987,10 @@ else if (Platform.ARCH.equals("mips64el")) {
*/
private static ArrayList<String> getLinuxLdPaths() {
ArrayList<String> ldPaths = new ArrayList<String>();
Process process = null;
BufferedReader reader = null;
try {
Process process = Runtime.getRuntime().exec("/sbin/ldconfig -p");
process = Runtime.getRuntime().exec("/sbin/ldconfig -p");
reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
String buffer;
while ((buffer = reader.readLine()) != null) {
Expand All @@ -1010,6 +1011,12 @@ private static ArrayList<String> getLinuxLdPaths() {
} catch (IOException e) {
}
}
if(process != null) {
try {
process.waitFor();
} catch (InterruptedException e) {
}
}
}
return ldPaths;
}
Expand Down

0 comments on commit 3e960b3

Please sign in to comment.