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