From 2365ddd2f2f140ba40982cbe015456e5507c69bf Mon Sep 17 00:00:00 2001 From: Ainar Garipov Date: Tue, 31 Aug 2021 15:14:08 +0300 Subject: [PATCH] Pull request: aghnet: imp windows nslookup Updates #3375. Squashed commit of the following: commit a98f376a3c8253b873cadb992b42174fb3c1c584 Author: Ainar Garipov Date: Tue Aug 31 15:06:03 2021 +0300 aghnet: imp windows nslookup --- internal/aghnet/systemresolvers_windows.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/aghnet/systemresolvers_windows.go b/internal/aghnet/systemresolvers_windows.go index 6341ef4f..5acdfa85 100644 --- a/internal/aghnet/systemresolvers_windows.go +++ b/internal/aghnet/systemresolvers_windows.go @@ -99,7 +99,13 @@ func scanAddrs(s *bufio.Scanner) (addrs []string) { // local resolvers addresses on Windows. We execute the external command for // now that is not the most accurate way. func (sr *systemResolvers) getAddrs() (addrs []string, err error) { - cmd := exec.Command("nslookup") + var cmdPath string + cmdPath, err = exec.LookPath("nslookup.exe") + if err != nil { + return nil, fmt.Errorf("looking up cmd path: %w", err) + } + + cmd := exec.Command(cmdPath) var stdin io.WriteCloser stdin, err = cmd.StdinPipe()