added windows support to dns-find-nameserver
original commit: 2b67432b43888c7c93f5384616a5bb2defba7170
This commit is contained in:
parent
bdeea7c188
commit
d3f8bb4d7d
|
@ -334,5 +334,22 @@
|
|||
(and m (cadr m))))
|
||||
(and (not (eof-object? l))
|
||||
(loop))))))))]
|
||||
[(windows)
|
||||
(let ([nslookup (find-executable-path "nslookup.exe" #f)])
|
||||
(and nslookup
|
||||
(let-values ([(p pout pin perr)
|
||||
(subprocess
|
||||
#f (open-input-file "NUL") (current-error-port)
|
||||
nslookup)])
|
||||
(let loop ([dns #f])
|
||||
(let ([line (read-line pout 'any)])
|
||||
(cond [(eof-object? line)
|
||||
(subprocess-wait p)
|
||||
dns]
|
||||
[(and (not dns)
|
||||
(regexp-match #rx"^Default Server: +(.*)$"
|
||||
line))
|
||||
=> (lambda (m) (loop (cadr m)))]
|
||||
[else (loop dns)]))))))]
|
||||
[else #f])))))
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user