Skip to content
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

Add installed check for fping #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

baweaver
Copy link

Current errors just raise no such file fping

Current errors just raise no such file fping
@penguinpowernz
Copy link
Owner

penguinpowernz commented Apr 3, 2017

Hmmm, sorry dude I'm not sure that satisfies the principle of least surprise. People are expecting to get an IP address from there, not an error message in a string.

I like the general idea though. Perhaps we could instead raise an error like Net::Fping::BinaryNotFound or Net::Fping::NotInstalled using your fping_installed? method as the check?

def BinaryNotFound < StandardError; end

def fping_installed!
  raise BinaryNotFound unless fping_installed?
end

But we should change the check to use %x[which fping] instead of system "which fping" as the latter could cause the library to print out the fping binary location everywhere it is called. Using the %x[] stanza will assign the output of which to the ether.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants