From 7b6dff318f84c61f633c72c65f2d8e73b9ad9364 Mon Sep 17 00:00:00 2001 From: Misty De Meo Date: Mon, 1 Aug 2016 17:09:33 +1000 Subject: doctor: return stub result if no dylib tool installed This will eventually support other tests, so the dylib test needs to be able to to meaningfully return an empty result --- lib/bundler/cli/doctor.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/bundler/cli/doctor.rb b/lib/bundler/cli/doctor.rb index 370e46ac69..df49315b45 100644 --- a/lib/bundler/cli/doctor.rb +++ b/lib/bundler/cli/doctor.rb @@ -13,6 +13,14 @@ module Bundler @options = options end + def otool_available? + system("otool --version 2>&1 >/dev/null") + end + + def ldd_available? + !system("ldd --help 2>&1 >/dev/null").nil? + end + def dylibs_darwin(path) output = `/usr/bin/otool -L "#{path}"`.chomp dylibs = output.split("\n")[1..-1].map {|l| l.match(DARWIN_REGEX).captures[0] }.uniq @@ -32,8 +40,10 @@ module Bundler def dylibs(path) case RbConfig::CONFIG["host_os"] when /darwin/ + return [] unless otool_available? dylibs_darwin(path) when /(linux|solaris|bsd)/ + return [] unless ldd_available? dylibs_ldd(path) else # Windows, etc. Bundler.ui.warn("Dynamic library check not supported on this platform.") -- cgit v1.2.1