[rubygems/rubygems] Fix resetting env in gem exec, and make sure it is set for gem exec gem

https://github.com/rubygems/rubygems/commit/13a6dd4992
This commit is contained in:
Samuel Giddins 2023-02-13 18:46:24 -08:00 коммит произвёл git
Родитель 2dd9698350
Коммит 80bfa1b30a
2 изменённых файлов: 5 добавлений и 3 удалений

Просмотреть файл

@ -56,12 +56,13 @@ to the same gem path as user-installed gems.
end
def execute
gem_paths = { "GEM_HOME": Gem.paths.home, "GEM_PATH": Gem.paths.path, "GEM_SPEC_CACHE": Gem.paths.spec_cache_dir }
gem_paths = { "GEM_HOME" => Gem.paths.home, "GEM_PATH" => Gem.paths.path.join(Gem.path_separator), "GEM_SPEC_CACHE" => Gem.paths.spec_cache_dir }
check_executable
print_command
if options[:gem_name] == "gem" && options[:executable] == "gem"
set_gem_exec_install_paths
Gem::GemRunner.new.run options[:args]
return
elsif options[:conservative]
@ -73,7 +74,8 @@ to the same gem path as user-installed gems.
load!
ensure
Gem.paths = gem_paths
ENV.update(gem_paths)
Gem.clear_paths
end
private

Просмотреть файл

@ -739,7 +739,7 @@ class TestGemCommandsExecCommand < Gem::TestCase
assert_match /\A\s*\** LOCAL GEMS \**\s*\z/m, @ui.output
invoke "gem", "env", "GEM_HOME"
assert_match /#{File::SEPARATOR}gem_exec$/, @ui.output
assert_equal "#{@gem_home}/gem_exec\n", @ui.output
end
end
end