aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike McQuaid2017-04-22 18:44:37 +0100
committerGitHub2017-04-22 18:44:37 +0100
commit671de2acc6cdb5e0889e1489f7edf6a204511797 (patch)
tree4133107dc6cc6146caf9765613033168ec151f73
parenta1b8d4179c9acdd5436bd86cd2f974c54c669696 (diff)
parent688034d22a3b8cfc1608a707689a1bf730a43bd5 (diff)
downloadbrew-671de2acc6cdb5e0889e1489f7edf6a204511797.tar.bz2
Merge pull request #2528 from MikeMcQuaid/which_editor_fixes
utils: fix which_editor.
-rw-r--r--Library/Homebrew/utils.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index 7a14916e1..f37b777ee 100644
--- a/Library/Homebrew/utils.rb
+++ b/Library/Homebrew/utils.rb
@@ -320,15 +320,15 @@ def which_all(cmd, path = ENV["PATH"])
end
def which_editor
- editor = ENV.values_at("HOMEBREW_EDITOR", "VISUAL").compact.first
+ editor = ENV.values_at("HOMEBREW_EDITOR", "VISUAL").compact.reject(&:empty?).first
return which(editor, ENV["HOMEBREW_PATH"]) unless editor.nil?
# Find Textmate
- editor = "mate" if which "mate"
+ editor = which("mate", ENV["HOMEBREW_PATH"])
# Find BBEdit / TextWrangler
- editor ||= "edit" if which "edit"
+ editor ||= which("edit", ENV["HOMEBREW_PATH"])
# Find vim
- editor ||= "vim" if which "vim"
+ editor ||= which("vim", ENV["HOMEBREW_PATH"])
# Default to standard vim
editor ||= "/usr/bin/vim"