From ea636140c73b18418f40007c6fabfb5f6b4fc8ae Mon Sep 17 00:00:00 2001 From: Matt Ellis Date: Mon, 6 Apr 2015 17:53:16 -0700 Subject: [PATCH] Allow Kestrel to boot when on CoreCLR and *NIX With cross platform .NET Core support coming online, we need to update our IsWindows check to not assume running on .NET Core means running on Windows. Since CoreFX doesn't yet expose a method for doing this (they are working on adding it back), we'll just call Uname and if that returns an empty string assume that we are on Windows. --- .../Networking/PlatformApis.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.AspNet.Server.Kestrel/Networking/PlatformApis.cs b/src/Microsoft.AspNet.Server.Kestrel/Networking/PlatformApis.cs index 55a2fe77b4..8bbb9df28a 100644 --- a/src/Microsoft.AspNet.Server.Kestrel/Networking/PlatformApis.cs +++ b/src/Microsoft.AspNet.Server.Kestrel/Networking/PlatformApis.cs @@ -13,7 +13,9 @@ namespace Microsoft.AspNet.Server.Kestrel.Networking public static bool IsWindows() { #if DNXCORE50 - return true; + // Until Environment.OSVersion.Platform is exposed on .NET Core, we + // try to call uname and if that fails we assume we are on Windows. + return GetUname() == string.Empty; #else var p = (int)Environment.OSVersion.Platform; return (p != 4) && (p != 6) && (p != 128);