Permalink
Browse files

properly handles commands with arguments.

  • Loading branch information...
1 parent bf2b15d commit ee15a7eb61d254c4c9d92a2afc74e36ea3ad3880 @adamsanderson committed May 2, 2009
Showing with 5 additions and 2 deletions.
  1. +5 −1 lib/rubygems/commands/open_command.rb
  2. +0 −1 test/open_command_test.rb
@@ -1,3 +1,5 @@
+require 'shellwords'
+
require 'rubygems/command'
require 'rubygems/dependency'
require 'rubygems/version_option'
@@ -60,7 +62,9 @@ def open_gem(path)
if !editor
say "Either set $EDITOR, or use -c <command_name>"
else
- success = system(editor, path)
+ command_parts = Shellwords.shellwords(editor)
+ command_parts << path
+ success = system(*command_parts)
if !success
raise Gem::CommandLineError, "Could not run '#{editor} #{path}', exit code: #{$?.exitstatus}"
end
@@ -38,5 +38,4 @@ def test_opening_with_no_gem_name
command.invoke()
end
end
-
end

0 comments on commit ee15a7e

Please sign in to comment.