Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions src/System.Management.Automation/CoreCLR/CorePsPlatform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down
23 changes: 0 additions & 23 deletions test/csharp/test_CorePsPlatform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down