From 5862edeb1290a96592c1deac96c515db90bb522b Mon Sep 17 00:00:00 2001 From: Mitchell Hwang Date: Tue, 9 Jun 2020 13:41:46 -0400 Subject: [PATCH] [libraries] Skip GetOpenSslVersion on Apple OS (#37646) Extend the `PlatformNotSupportedException` for `OpenSslVersion` from `OSX` to `OSX, iOS, and tvOS`, as none of these Apple OS support OpenSsl. Co-authored-by: Mitchell Hwang --- .../Common/tests/TestUtilities/System/PlatformDetection.Unix.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs index 38fb7d5..bb5bb4b 100644 --- a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs +++ b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs @@ -45,12 +45,16 @@ namespace System public static bool IsRedHatFamily7 => IsRedHatFamilyAndVersion(7); public static bool IsNotFedoraOrRedHatFamily => !IsFedora && !IsRedHatFamily; public static bool IsNotDebian10 => !IsDebian10; + public static bool IsNotApple => + !RuntimeInformation.IsOSPlatform(OSPlatform.Create("IOS")) && + !RuntimeInformation.IsOSPlatform(OSPlatform.OSX) && + !RuntimeInformation.IsOSPlatform(OSPlatform.Create("TVOS")); public static bool IsSuperUser => !IsWindows ? libc.geteuid() == 0 : throw new PlatformNotSupportedException(); - public static Version OpenSslVersion => !IsOSX && !IsWindows ? + public static Version OpenSslVersion => IsNotApple && !IsWindows ? GetOpenSslVersion() : throw new PlatformNotSupportedException(); -- 2.7.4