Skip to content

Commit

Permalink
I am an idiot.
Browse files Browse the repository at this point in the history
  • Loading branch information
e3ndr committed May 28, 2024
1 parent 61d0837 commit c7e778e
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package co.casterlabs.commons.platform;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;

/**
* This class allows you to detect whether or not a machine uses GNU or MUSL
Expand Down Expand Up @@ -42,8 +42,10 @@ public static boolean isGNU() throws IOException {
}

private static boolean isGNUViaFS() throws IOException {
String ldd = Files.readString(Path.of("/usr/bin/ldd"));
return ldd.contains("GNU C Library");
try (FileInputStream fin = new FileInputStream(new File("/usr/bin/ldd"))) {
String ldd = _PlatformUtil.readInputStreamString(fin, StandardCharsets.UTF_8);
return ldd.contains("GNU C Library");
}
}

private static boolean isGNUViaCommand() throws IOException {
Expand Down

0 comments on commit c7e778e

Please sign in to comment.