[rubygems/rubygems] Only update env if var exists

Will save on an error if it would be nil from an exception happening during that line

https://github.com/rubygems/rubygems/commit/d6797a04e9
This commit is contained in:
Samuel Giddins 2023-02-21 07:52:53 -05:00 коммит произвёл git
Родитель 616a7e1f6c
Коммит 0ca3a095be
1 изменённых файлов: 2 добавлений и 2 удалений

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

@ -56,7 +56,7 @@ to the same gem path as user-installed gems.
end
def execute
gem_paths = { "GEM_HOME" => Gem.paths.home, "GEM_PATH" => Gem.paths.path.join(Gem.path_separator), "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 }.compact
check_executable
@ -74,7 +74,7 @@ to the same gem path as user-installed gems.
load!
ensure
ENV.update(gem_paths)
ENV.update(gem_paths) if gem_paths
Gem.clear_paths
end