diff options
| author | samueljohn | 2012-02-07 16:08:06 +0100 |
|---|---|---|
| committer | Jack Nagel | 2012-02-08 14:41:55 -0600 |
| commit | 0eb1cadee01f0412e2a08578045d0784f2f1c071 (patch) | |
| tree | b5127cf366677368d503140f96a000bbed73443e /Library | |
| parent | a671a13b24d1895ae80c90e040b6647192a9dfe8 (diff) | |
| download | brew-0eb1cadee01f0412e2a08578045d0784f2f1c071.tar.bz2 | |
brew --config: properly handle empty `which` strings
Symptom: If no python/ruby/perl is in your path, then `which x`.chomp
returns an empty string and `unless ""` is still true. So, N/A is never
displayed. Instead, ruby's Pathname.new("").realpath returns the cwd.
(I consider this realpath behavior a ruby bug) Fix: use empty?
Closes Homebrew/homebrew#10027.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/cmd/--config.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Library/Homebrew/cmd/--config.rb b/Library/Homebrew/cmd/--config.rb index db11a0d87..9b6fec110 100644 --- a/Library/Homebrew/cmd/--config.rb +++ b/Library/Homebrew/cmd/--config.rb @@ -38,7 +38,7 @@ module Homebrew extend self def describe_perl perl = `which perl`.chomp - return "N/A" unless perl + return "N/A" if perl.empty? real_perl = Pathname.new(perl).realpath.to_s return perl if perl == real_perl @@ -47,7 +47,7 @@ module Homebrew extend self def describe_python python = `which python`.chomp - return "N/A" unless python + return "N/A" if python.empty? real_python = Pathname.new(python).realpath.to_s @@ -57,7 +57,7 @@ module Homebrew extend self def describe_ruby ruby = `which ruby`.chomp - return "N/A" unless ruby + return "N/A" if ruby.empty? real_ruby = Pathname.new(ruby).realpath.to_s return ruby if ruby == real_ruby |
