diff options
Diffstat (limited to 'Library/Homebrew/utils.rb')
| -rw-r--r-- | Library/Homebrew/utils.rb | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 3ae8e1181..f5530c29f 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -147,9 +147,8 @@ def puts_columns items, star_items=[] end end -def which cmd, silent=false - cmd += " 2>/dev/null" if silent - path = `/usr/bin/which #{cmd}`.chomp +def which cmd + path = `/usr/bin/which #{cmd} 2>/dev/null`.chomp if path.empty? nil else @@ -157,19 +156,15 @@ def which cmd, silent=false end end -def which_s cmd - which cmd, true -end - def which_editor editor = ENV['HOMEBREW_EDITOR'] || ENV['EDITOR'] # If an editor wasn't set, try to pick a sane default return editor unless editor.nil? # Find Textmate - return 'mate' if which_s "mate" + return 'mate' if which "mate" # Find # BBEdit / TextWrangler - return 'edit' if which_s "edit" + return 'edit' if which "edit" # Default to vim return '/usr/bin/vim' end @@ -405,7 +400,7 @@ module MacOS extend self # Xcode 4.3 xc* tools hang indefinately if xcode-select path is set thus raise if `xcode-select -print-path 2>/dev/null`.chomp == "/" - raise unless which_s "xcodebuild" + raise unless which "xcodebuild" `xcodebuild -version 2>/dev/null` =~ /Xcode (\d(\.\d)*)/ raise if $1.nil? or not $?.success? $1 |
