-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check exit code of hostname -f
for failures
#219
Conversation
lib/dogapi/common.rb
Outdated
@@ -200,9 +200,12 @@ def Dogapi.find_datadog_host | |||
@@hostname = nil | |||
|
|||
def Dogapi.find_localhost | |||
@@hostname ||= %x[hostname -f].strip | |||
unless @@hostname | |||
@@hostname, status = Open3.capture2("hostname", "-f", :err=>File::NULL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to strip whitespaces?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh good catch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💚
Updates the dogapi gem dependency to its latest version, in particular to get DataDog/dogapi-rb#219.
What does this PR do?
fixes #57
Description of the Change
%x["hostname -f"]
call doesn't necessarily raise aSystemCallError
(on windows 10 notably) on failure, so additionally check for exit status code.Verification Process
manual testing on windows
Review checklist (to be filled by reviewers)
changelog/
label attached. If applicable it should have thebackward-incompatible
label attached.do-not-merge/
label attached.kind/
andseverity/
labels attached at least.