Skip to content

Commit

Permalink
properly handles commands with arguments.
Browse files Browse the repository at this point in the history
  • Loading branch information
adamsanderson committed May 2, 2009
1 parent bf2b15d commit ee15a7e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/rubygems/commands/open_command.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require 'shellwords'

require 'rubygems/command'
require 'rubygems/dependency'
require 'rubygems/version_option'
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion test/open_command_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.