Don't return null for unknown os name

This commit is contained in:
crschnick 2024-01-09 04:39:02 +00:00
parent 522c2c1664
commit a6cb7b1a30

View file

@ -141,14 +141,14 @@ public sealed interface OsType permits OsType.Windows, OsType.Linux, OsType.MacO
try (CommandControl c = pc.command("lsb_release -a").start()) {
var text = c.readStdoutDiscardErr();
if (c.getExitCode() == 0) {
return PropertiesFormatsParser.parse(text, ":").getOrDefault("Description", null);
return PropertiesFormatsParser.parse(text, ":").getOrDefault("Description", "Unknown");
}
}
try (CommandControl c = pc.command("cat /etc/*release").start()) {
var text = c.readStdoutDiscardErr();
if (c.getExitCode() == 0) {
return PropertiesFormatsParser.parse(text, "=").getOrDefault("PRETTY_NAME", null);
return PropertiesFormatsParser.parse(text, "=").getOrDefault("PRETTY_NAME", "Unknown");
}
}