diff --git a/lib/rubygems/commands/exec_command.rb b/lib/rubygems/commands/exec_command.rb index 7985b0fda6..519539c694 100644 --- a/lib/rubygems/commands/exec_command.rb +++ b/lib/rubygems/commands/exec_command.rb @@ -222,8 +222,11 @@ to the same gem path as user-installed gems. terminate_interaction 1 end + old_exe = $0 + $0 = exe load Gem.activate_bin_path(contains_executable.first.name, exe, ">= 0.a") ensure + $0 = old_exe if old_exe ARGV.replace argv end