End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
class method
Gem.read_binary
read_binary(path)
lib/rubygems.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.0.5/lib/rubygems.rb, line 781
def self.read_binary(path)
File.open path, 'rb+' do |f|
f.flock(File::LOCK_EX)
f.read
end
rescue *READ_BINARY_ERRORS
File.open path, 'rb' do |f|
f.read
end
rescue Errno::ENOLCK # NFS
if Thread.main != Thread.current
raise
else
File.open path, 'rb' do |f|
f.read
end
end
end
Safely read a file in binary mode on all platforms.
See also
.pre_uninstall
.refresh
.pre_reset
.register_default_spec
also in
4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1