diff options
| author | Edouard CHIN <chin.edouard@gmail.com> | 2026-01-12 15:09:36 +0100 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2026-01-13 11:12:00 +0000 |
| commit | b722d37f21ff0b148bdadb1b6aed6532f9beb9bf (patch) | |
| tree | 81dc4436a0142aefd2da6a84362ddaa90931d02f | |
| parent | b7dbdfe23ad443ca796f471144be99c00d5ce583 (diff) | |
[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
| -rw-r--r-- | lib/rubygems/installer.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb index 90aa25dc07..914e413677 100644 --- a/lib/rubygems/installer.rb +++ b/lib/rubygems/installer.rb @@ -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 |
