Skip to content

Commit b722d37

Browse files
Edouard-chinmatzbot
authored andcommitted
[ruby/rubygems] Add a missing "require 'etc'" statement:
- Ref ruby/rubygems#9171 (comment) - Referencing the constant Etc may raise a `NameError` depending on whether other Rubygems/Bundler codepath have evaluated a prior "require 'etc'". This can be reproduced with this Gemfile: ```ruby source "https://rubygems.org" gem 'prism', github: "ruby/prism" ``` ruby/rubygems@5d435e6863
1 parent b7dbdfe commit b722d37

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/rubygems/installer.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,12 @@ def build_args
943943
end
944944

945945
def build_jobs
946-
@build_jobs ||= Etc.nprocessors + 1
946+
@build_jobs ||= begin
947+
require "etc"
948+
Etc.nprocessors + 1
949+
rescue LoadError
950+
1
951+
end
947952
end
948953

949954
def rb_config

0 commit comments

Comments
 (0)