зеркало из https://github.com/github/ruby.git
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). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
b4621c9aae
Коммит
51a38a2401
|
@ -1,8 +1,8 @@
|
|||
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
|
||||
|
|
Загрузка…
Ссылка в новой задаче