Skip to content

Commit

Permalink
Bin: restrict how and where bin/dnssd can be run
Browse files Browse the repository at this point in the history
  • Loading branch information
jmoody committed Jul 27, 2016
1 parent dfa61e7 commit f0f6326
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions bin/dnssd
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,23 @@ Thread.abort_on_exception = true
trap 'INT' do exit end
trap 'TERM' do exit end

if RUBY_PLATFORM[/darwin/]
require "dnssd"
if defined?(Bundler)
raise "This tool cannot be called in the context of bundle exec"
elsif RUBY_PLATFORM[/darwin/]
begin
require "dnssd"
rescue LoadError => _
raise %Q[
This tool requires the dnssd gem which is not installed. Install it:
gem install dnssd --version 2.0
and try again.
]
end
else
raise "dnssd gem is not available on #{RUBY_PLATFORM}"
raise "This tool is not available on #{RUBY_PLATFORM}"
end

services = []
Expand Down

0 comments on commit f0f6326

Please sign in to comment.