From 1e503bf95028d42578d8d13d72310978919c0a7d Mon Sep 17 00:00:00 2001 From: Anas Sulaiman Date: Wed, 15 Nov 2023 04:30:40 +0000 Subject: [PATCH] don't confuse users with unimportant and non-actionable error msg Bug: b/310852966 Change-Id: I2c64a92a36b817043ff1f7abfa528d4c7aa449e8 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5030272 Reviewed-by: Michael Savigny Reviewed-by: Junji Watanabe Commit-Queue: Anas Sulaiman --- reclient_helper.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/reclient_helper.py b/reclient_helper.py index 2b99707e6..6bcc962c7 100644 --- a/reclient_helper.py +++ b/reclient_helper.py @@ -123,12 +123,11 @@ def auth_cache_status(): def get_hostname(): hostname = socket.gethostname() + # In case that returned an address, make a best effort attempt to get + # the hostname and ignore any errors. try: return socket.gethostbyaddr(hostname)[0] - except Exception as e: - print("socket.gethostbyaddr failed " + - "(falling back to socket.gethostname): %s" % e, - file=sys.stderr) + except Exception: return hostname