summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2023-02-21 07:52:53 -0500
committergit <svn-admin@ruby-lang.org>2023-02-22 08:42:19 +0000
commit0ca3a095be988c6382e92240118384a8028a5c6d (patch)
tree8a3799e433493a7c9f81a3aad12a03800909118a
parent616a7e1f6c789e5844b4fca9e84fe85656ecc62a (diff)
[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
-rw-r--r--lib/rubygems/commands/exec_command.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/rubygems/commands/exec_command.rb b/lib/rubygems/commands/exec_command.rb
index 87c1cf9051..c708ad78ad 100644
--- a/lib/rubygems/commands/exec_command.rb
+++ b/lib/rubygems/commands/exec_command.rb
@@ -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