mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 10:41:31 +00:00
avoid unnecessary failures in get_hostname
The catch clause was specific to one error type, but other errors may also happen such as socket.herror. In any case, the point is to fallback anyways. Bug: b/310216577 Change-Id: I55561f8f40446f90bee27ea2aab1a4e60c03e7e6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5024019 Reviewed-by: Junji Watanabe <jwata@google.com> Commit-Queue: Anas Sulaiman <mrahs@google.com> Reviewed-by: Michael Savigny <msavigny@google.com>
This commit is contained in:
@@ -125,7 +125,10 @@ def get_hostname():
|
||||
hostname = socket.gethostname()
|
||||
try:
|
||||
return socket.gethostbyaddr(hostname)[0]
|
||||
except socket.gaierror:
|
||||
except Exception as e:
|
||||
print("socket.gethostbyaddr failed " +
|
||||
"(falling back to socket.gethostname): %s" % e,
|
||||
file=sys.stderr)
|
||||
return hostname
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user