private static OsFlavor DetermineOSFlavor() { if (!IsUnix) // assume Windows { return(OsFlavor.Windows); } string uname = null; try { uname = ShellExecutor.GetOutput("uname", ""); } catch (Exception ex) { Log.ErrorException(ex, "Couldn't determine the flavor of Unix-like OS."); } uname = uname.Trim().ToLower(); switch (uname) { case "linux": return(OsFlavor.Linux); case "darwin": return(OsFlavor.MacOS); case "freebsd": case "netbsd": case "openbsd": return(OsFlavor.BSD); default: return(OsFlavor.Unknown); } }
private static OsFlavor DetermineOSFlavor() { if (!IsUnix) // assume Windows { return(OsFlavor.Windows); } string uname = null; try { uname = ShellExecutor.GetOutput("uname", ""); } catch (Exception ex) { Log.ErrorException(ex, "Couldn't determine the flavor of Unix-like OS."); } switch (uname) { case "Linux": return(OsFlavor.Linux); case "Darwin": return(OsFlavor.MacOS); case "FreeBSD": case "NetBSD": case "OpenBSD": return(OsFlavor.BSD); default: return(OsFlavor.Unknown); } }