[ruby/rubygems] Add a missing "require 'etc'" statement:

- Ref https://github.com/ruby/rubygems/pull/9171#discussion_r2658056892
- 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"
  ```

https://github.com/ruby/rubygems/commit/5d435e6863
This commit is contained in:
Edouard CHIN 2026-01-12 15:09:36 +01:00 committed by git
parent b7dbdfe23a
commit b722d37f21

View File

@ -943,7 +943,12 @@ class Gem::Installer
end
def build_jobs
@build_jobs ||= Etc.nprocessors + 1
@build_jobs ||= begin
require "etc"
Etc.nprocessors + 1
rescue LoadError
1
end
end
def rb_config