cmd/cli: do not get windows feature for checking DNS installed

"Get-WindowsFeature -Name DNS" is slow to run, and seems to make low
resources Windows VM slow down so much.
This commit is contained in:
Cuong Manh Le
2024-05-07 02:19:29 +07:00
committed by Cuong Manh Le
parent a1fda2c0de
commit ac97c88876

View File

@@ -2450,11 +2450,6 @@ func powershell(cmd string) ([]byte, error) {
// windowsHasLocalDnsServerRunning reports whether we are on Windows and having Dns server running.
func windowsHasLocalDnsServerRunning() bool {
if runtime.GOOS == "windows" {
out, _ := powershell("Get-WindowsFeature -Name DNS")
if !bytes.Contains(bytes.ToLower(out), []byte("installed")) {
return false
}
_, err := powershell("Get-Process -Name DNS")
return err == nil
}