aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/utils.rb
diff options
context:
space:
mode:
authorAdam Vandenberg2011-04-12 10:09:33 -0700
committerAdam Vandenberg2011-04-12 10:09:41 -0700
commite3c6d9bf0008b3f32b2ad370cf9639be4c80f0d9 (patch)
tree4023f15141af35147798757fd3d83c6cb2b31802 /Library/Homebrew/utils.rb
parentdfcff44e3e9129b7779e5baadc336a6d3156373f (diff)
downloadbrew-e3c6d9bf0008b3f32b2ad370cf9639be4c80f0d9.tar.bz2
Handle complex $EDITOR values.
Diffstat (limited to 'Library/Homebrew/utils.rb')
-rw-r--r--Library/Homebrew/utils.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index 080a099ea..75609a4e7 100644
--- a/Library/Homebrew/utils.rb
+++ b/Library/Homebrew/utils.rb
@@ -131,10 +131,11 @@ def exec_editor *args
'/usr/bin/vim' # Default to vim
end
end
- # we split the editor because especially on mac "mate -w" is common
- # but we still want to use the comma-delimited version of exec because then
- # we don't have to escape args, and escaping 100% is tricky
- exec *(editor.split + args) unless args.empty?
+
+ # Invoke bash to evaluate env vars in $EDITOR
+ # This also gets us proper argument quoting.
+ # See: https://github.com/mxcl/homebrew/issues/5123
+ system "bash", "-c", editor + ' "$@"', "--", *args
end
# GZips the given paths, and returns the gzipped paths