Skip to content

Commit 798aee2

Browse files
committed
Fixing issue for coreclr on Mac
1 parent b0b797c commit 798aee2

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/LightningDB/Native/PlatformApis.cs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public static bool IsWindows()
1111
#if DNXCORE50
1212
// Until Environment.OSVersion.Platform is exposed on .NET Core, we
1313
// try to call uname and if that fails we assume we are on Windows.
14-
return true;
14+
return GetUname() == string.Empty;
1515
#else
1616
var p = (int)Environment.OSVersion.Platform;
1717
return (p != 4) && (p != 6) && (p != 128);
@@ -21,24 +21,25 @@ public static bool IsWindows()
2121
[DllImport("libc")]
2222
static extern int uname(StringBuilder buf);
2323

24-
public static bool IsDarwin()
24+
private static string GetUname()
2525
{
2626
var buffer = new StringBuilder(8192);
2727
try
2828
{
29-
if (uname(buffer) == 0)
29+
if(uname(buffer) == 0)
3030
{
31-
return string.Equals(
32-
buffer.ToString(),
33-
"Darwin",
34-
StringComparison.Ordinal);
31+
return buffer.ToString();
3532
}
3633
}
37-
catch (Exception)
34+
catch
3835
{
3936
}
37+
return string.Empty;
38+
}
4039

41-
return false;
40+
public static bool IsDarwin()
41+
{
42+
return string.Equals(GetUname(), "Darwin", StringComparison.Ordinal);
4243
}
4344
}
4445
}

0 commit comments

Comments
 (0)