public static OperatingSystem getCurrent() {
    String name = System.getProperty("os.name");
    String version = System.getProperty("os.version");
    String lowerName = name.toLowerCase(Locale.ROOT);
    if (lowerName.contains("linux")) return new OperatingSystem(name, version, Family.LINUX);
    if (lowerName.contains("mac os") || lowerName.contains("darwin")) return new OperatingSystem(name, version, Family.MAC_OS);
    if (lowerName.contains("windows")) return new OperatingSystem(name, version, Family.WINDOWS);
    if (lowerName.contains("sunos")) return new OperatingSystem(name, version, Family.SOLARIS);
    return new OperatingSystem(name, version, Family.OTHER);
  }
Returns the current operating system.

@return the current operating system
spock-core/src/main/java/spock/util/environment/OperatingSystem.java