Detect mono using PlatformAbstractions
This commit is contained in:
parent
db11368d26
commit
b4b5f07a08
|
|
@ -12,7 +12,7 @@ namespace Microsoft.AspNet.Server.Kestrel.Networking
|
|||
{
|
||||
IsWindows = PlatformApis.IsWindows;
|
||||
|
||||
var isDarwinMono = !IsWindows && PlatformApis.IsDarwin;
|
||||
var isDarwinMono = PlatformApis.IsDarwin && PlatformApis.IsMono;
|
||||
|
||||
if (isDarwinMono)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.Extensions.PlatformAbstractions;
|
||||
|
||||
namespace Microsoft.AspNet.Server.Kestrel.Networking
|
||||
{
|
||||
|
|
@ -24,12 +25,16 @@ namespace Microsoft.AspNet.Server.Kestrel.Networking
|
|||
IsDarwin = string.Equals(GetUname(), "Darwin", StringComparison.Ordinal);
|
||||
}
|
||||
#endif
|
||||
|
||||
IsMono = PlatformServices.Default.Runtime.RuntimeType == "Mono";
|
||||
}
|
||||
|
||||
public static bool IsWindows { get; }
|
||||
|
||||
public static bool IsDarwin { get; }
|
||||
|
||||
public static bool IsMono { get; }
|
||||
|
||||
[DllImport("libc")]
|
||||
static extern int uname(IntPtr buf);
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
"dependencies": {
|
||||
"Microsoft.AspNet.Hosting": "1.0.0-*",
|
||||
"Microsoft.Extensions.Logging.Abstractions": "1.0.0-*",
|
||||
"Microsoft.Extensions.PlatformAbstractions": "1.0.0-*",
|
||||
"System.Numerics.Vectors": "4.1.1-*",
|
||||
"Microsoft.StandardsPolice": {
|
||||
"version": "1.0.0-*",
|
||||
|
|
|
|||
Loading…
Reference in New Issue