diff options
| author | Mike McQuaid | 2017-04-22 17:28:51 +0100 |
|---|---|---|
| committer | Mike McQuaid | 2017-04-22 17:29:59 +0100 |
| commit | 688034d22a3b8cfc1608a707689a1bf730a43bd5 (patch) | |
| tree | aca5114acfdf5115ec3ac338e8d2508e7e2b8603 | |
| parent | 114e8c55378a28d8ab285132ee28fb6464606962 (diff) | |
| download | brew-688034d22a3b8cfc1608a707689a1bf730a43bd5.tar.bz2 | |
utils: fix which_editor.
Handle when there's no editor variable specified or it's specified but
empty.
| -rw-r--r-- | Library/Homebrew/utils.rb | 8 |
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" |
