File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ public static bool IsWindows()
11
11
#if DNXCORE50
12
12
// Until Environment.OSVersion.Platform is exposed on .NET Core, we
13
13
// try to call uname and if that fails we assume we are on Windows.
14
- return true ;
14
+ return GetUname ( ) == string . Empty ;
15
15
#else
16
16
var p = ( int ) Environment . OSVersion . Platform ;
17
17
return ( p != 4 ) && ( p != 6 ) && ( p != 128 ) ;
@@ -21,24 +21,25 @@ public static bool IsWindows()
21
21
[ DllImport ( "libc" ) ]
22
22
static extern int uname ( StringBuilder buf ) ;
23
23
24
- public static bool IsDarwin ( )
24
+ private static string GetUname ( )
25
25
{
26
26
var buffer = new StringBuilder ( 8192 ) ;
27
27
try
28
28
{
29
- if ( uname ( buffer ) == 0 )
29
+ if ( uname ( buffer ) == 0 )
30
30
{
31
- return string . Equals (
32
- buffer . ToString ( ) ,
33
- "Darwin" ,
34
- StringComparison . Ordinal ) ;
31
+ return buffer . ToString ( ) ;
35
32
}
36
33
}
37
- catch ( Exception )
34
+ catch
38
35
{
39
36
}
37
+ return string . Empty ;
38
+ }
40
39
41
- return false ;
40
+ public static bool IsDarwin ( )
41
+ {
42
+ return string . Equals ( GetUname ( ) , "Darwin" , StringComparison . Ordinal ) ;
42
43
}
43
44
}
44
45
}
You can’t perform that action at this time.
0 commit comments