diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2021-12-13 16:53:50 +0100 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2021-12-15 19:46:44 +0900 |
commit | 9f87c0cc6dff70e8a1c4d204d1d45920d26f2e3a (patch) | |
tree | 137f13cb562f16c14374ceff86ad32dd2d7b13ea /lib/rubygems.rb | |
parent | c2dbdf3067c334e22946fbda74181d3a94afbf97 (diff) | |
download | ruby-9f87c0cc6dff70e8a1c4d204d1d45920d26f2e3a.tar.gz |
[rubygems/rubygems] Pass `:bimode` explicitly to `File.open`
The `File::BINARY` flag is apparently ignored due to a ruby bug, and
thus writing can cause encoding issues.
https://github.com/rubygems/rubygems/commit/db4efbebf2
Diffstat (limited to 'lib/rubygems.rb')
-rw-r--r-- | lib/rubygems.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/rubygems.rb b/lib/rubygems.rb index b7dda38d52..40f3a893d8 100644 --- a/lib/rubygems.rb +++ b/lib/rubygems.rb @@ -800,7 +800,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]} ## # Safely write a file in binary mode on all platforms. def self.write_binary(path, data) - File.open(path, File::RDWR | File::CREAT | File::BINARY | File::LOCK_EX) do |io| + File.open(path, File::RDWR | File::CREAT | File::LOCK_EX, binmode: true) do |io| io.write data end rescue *WRITE_BINARY_ERRORS |