summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Arko <andre@arko.net>2014-04-28 05:30:36 -0700
committerAndre Arko <andre@arko.net>2014-06-15 22:25:55 -0700
commita1d54be8fcc2cdcfbab03a655e9a565b35db53c0 (patch)
treeaf70c334f845bdf26d5c1d76d7d899ef03c19ad0
parent8ec5d4c93dcf6cbfa09cb1c436d94c7ca3bc310d (diff)
downloadbundler-a1d54be8fcc2cdcfbab03a655e9a565b35db53c0.tar.gz
editor might need shell parsing
-rw-r--r--lib/bundler/cli/open.rb9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/bundler/cli/open.rb b/lib/bundler/cli/open.rb
index a5a88dfc76..39c1a6cb56 100644
--- a/lib/bundler/cli/open.rb
+++ b/lib/bundler/cli/open.rb
@@ -1,4 +1,5 @@
require 'bundler/cli/common'
+require 'shellwords'
module Bundler
class CLI::Open
@@ -11,11 +12,9 @@ module Bundler
def run
editor = [ENV['BUNDLER_EDITOR'], ENV['VISUAL'], ENV['EDITOR']].find{|e| !e.nil? && !e.empty? }
return Bundler.ui.info("To open a bundled gem, set $EDITOR or $BUNDLER_EDITOR") unless editor
- spec = Bundler::CLI::Common.select_spec(name, :regex_match)
- return unless spec
- full_gem_path = spec.full_gem_path
- Dir.chdir(full_gem_path) do
- command = [editor, full_gem_path]
+ path = Bundler::CLI::Common.select_spec(name, :regex_match).full_gem_path
+ Dir.chdir(path) do
+ command = [*Shellwords.split(editor), path]
system(*command) || Bundler.ui.info("Could not run '#{command.join(' ')}'")
end
end