Added FreeBSD detection
This commit is contained in:
parent
309e43ac2d
commit
1ba2cb8ba8
|
@ -118,6 +118,32 @@ class OSUtil {
|
|||
}
|
||||
}
|
||||
|
||||
public static
|
||||
class Unix {
|
||||
public static
|
||||
boolean isFreeBSD() {
|
||||
if (!OS.isUnix()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(8196);
|
||||
PrintStream outputStream = new PrintStream(byteArrayOutputStream);
|
||||
|
||||
// uname
|
||||
final ShellProcessBuilder shell = new ShellProcessBuilder(outputStream);
|
||||
shell.setExecutable("uname");
|
||||
shell.start();
|
||||
|
||||
String output = ShellProcessBuilder.getOutput(byteArrayOutputStream);
|
||||
return output.startsWith("FreeBSD");
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static
|
||||
class Linux {
|
||||
public static
|
||||
|
|
Loading…
Reference in New Issue
Block a user