This commit is contained in:
Andrew Pimenov 2026-09-10 11:41:00 +03:00 • committed by GitHub
commit cd739768b2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -201,7 +201,8 @@ def _resolvers_windows() -> dict[str, list[str]]:
def _resolvers_unix() -> dict[str, list[str]]:
adapters: dict[str, list[str]] = {}
try:
text = open("/etc/resolv.conf", encoding="utf-8", errors="replace").read()
with open("/etc/resolv.conf", encoding="utf-8", errors="replace") as f:
text = f.read()
except OSError:
text = ""
servers = [line.split()[1] for line in text.splitlines() if line.startswith("nameserver") and len(line.split()) > 1]