From cd3690cc85539d59c41aaf8a7388acd3d0e26253 Mon Sep 17 00:00:00 2001 From: iSazonov Date: Mon, 28 May 2018 11:36:24 +0500 Subject: [PATCH] Cleanup NonWindowsGetDomainName() --- .../CoreCLR/CorePsPlatform.cs | 16 ------------- test/csharp/test_CorePsPlatform.cs | 23 ------------------- 2 files changed, 39 deletions(-) diff --git a/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs b/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs index 7d5dee725e6..aa9b119125f 100644 --- a/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs +++ b/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs @@ -545,22 +545,6 @@ internal static unsafe bool NonWindowsSetDate(DateTime dateToUse) return Unix.NativeMethods.SetDate(&tm) == 0; } - internal static string NonWindowsGetDomainName() - { - string name = Unix.NativeMethods.GetFullyQualifiedName(); - if (!string.IsNullOrEmpty(name)) - { - // name is hostname.domainname, so extract domainname - int index = name.IndexOf('.'); - if (index >= 0) - { - return name.Substring(index + 1); - } - } - // if the domain name could not be found, do not throw, just return empty - return string.Empty; - } - // Hostname in this context seems to be the FQDN internal static string NonWindowsGetHostName() { diff --git a/test/csharp/test_CorePsPlatform.cs b/test/csharp/test_CorePsPlatform.cs index 82144630e32..daf688380f0 100644 --- a/test/csharp/test_CorePsPlatform.cs +++ b/test/csharp/test_CorePsPlatform.cs @@ -86,29 +86,6 @@ public static void TestGetFQDN() } } - [Fact] - public static void TestGetDomainName() - { - var startInfo = new ProcessStartInfo - { - FileName = @"/usr/bin/env", - Arguments = "dnsdomainname", - RedirectStandardOutput = true, - UseShellExecute = false - }; - using (Process process = Process.Start(startInfo)) - { - // Get output of call to hostname without trailing newline - string domainName = process.StandardOutput.ReadToEnd().Trim(); - process.WaitForExit(); - - // The process should return an exit code of 0 on success - Assert.Equal(0, process.ExitCode); - // It should be the same as what our platform code returns - Assert.Equal(domainName, Platform.NonWindowsGetDomainName()); - } - } - [Fact] public static void TestIsExecutable() {