From 2529958e8cedd78f2d229acf46252248094730fd Mon Sep 17 00:00:00 2001 From: Adam Vandenberg Date: Tue, 12 Apr 2011 10:09:33 -0700 Subject: Handle complex $EDITOR values. --- Library/Homebrew/utils.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'Library') 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 -- cgit v1.2.3