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.
This commit is contained in:
Matt Ellis 2015-04-06 17:53:16 -07:00
parent ee9211a116
commit ea636140c7
1 changed files with 3 additions and 1 deletions

View File

@ -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);