From 83456d1e9aeb66ec64365343b38af66c83b4bce8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Tue, 8 Oct 2024 23:55:12 +0200 Subject: [PATCH] [rubygems/rubygems] Fix plugin command loading The `LoadError` needs to be ignored because command may have been defined and registered from a rubygems_plugin.rb file. https://github.com/rubygems/rubygems/commit/31f13d449b --- lib/rubygems/command_manager.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/rubygems/command_manager.rb b/lib/rubygems/command_manager.rb index 4d54d1d49d..15834ce4dd 100644 --- a/lib/rubygems/command_manager.rb +++ b/lib/rubygems/command_manager.rb @@ -232,9 +232,14 @@ class Gem::CommandManager const_name = command_name.capitalize.gsub(/_(.)/) { $1.upcase } << "Command" begin - require "rubygems/commands/#{command_name}_command" + begin + require "rubygems/commands/#{command_name}_command" + rescue LoadError + # it may have been defined from a rubygems_plugin.rb file + end + Gem::Commands.const_get(const_name).new - rescue StandardError, LoadError => e + rescue StandardError => e alert_error clean_text("Loading command: #{command_name} (#{e.class})\n\t#{e}") ui.backtrace e end