End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
class method
Gem.write_binary
write_binary(path, data)
lib/rubygems.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.2.0/lib/rubygems.rb, line 773
def self.write_binary(path, data)
open_file(path, "wb") do |io|
io.write data
end
rescue Errno::ENOSPC
# If we ran out of space but the file exists, it's *guaranteed* to be corrupted.
File.delete(path) if File.exist?(path)
raise
end
Safely write a file in binary mode on all platforms.