ruby-changes:46876
From: eregon <ko1@a...>
Date: Fri, 2 Jun 2017 02:08:52 +0900 (JST)
Subject: [ruby-changes:46876] eregon:r58991 (trunk): Open files in binary modes for copying in MSpec's #cp
eregon 2017-06-02 02:08:47 +0900 (Fri, 02 Jun 2017) New Revision: 58991 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58991 Log: Open files in binary modes for copying in MSpec's #cp * See https://bugs.ruby-lang.org/issues/13570. * Found by MSP-Greg (Greg L). Modified files: trunk/spec/mspec/lib/mspec/helpers/fs.rb Index: spec/mspec/lib/mspec/helpers/fs.rb =================================================================== --- spec/mspec/lib/mspec/helpers/fs.rb (revision 58990) +++ spec/mspec/lib/mspec/helpers/fs.rb (revision 58991) @@ -1,8 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/spec/mspec/lib/mspec/helpers/fs.rb#L1 class Object # Copies a file def cp(source, dest) - File.open(dest, "w") do |d| - File.open(source, "r") do |s| + File.open(dest, "wb") do |d| + File.open(source, "rb") do |s| while data = s.read(1024) d.write data end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/