You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I mean, I wouldn't normally expect that IO.copy_stream would rewind the destination, but MRI does it, and we're currently relying on that behaviour in Refile (although we will add the rewind now). Just to help you to be the closest to MRI :)
# MRI 2.2.0require"stringio"require"tempfile"file=Tempfile.new('foo')IO.copy_stream(StringIO.new('foo'),file)file.eof?#=> false (it's on the beginning)
This looks like a bug in MRI, probably when using copy_stream with Tempfile. Here it is with a normal file, showing that it definitely does not rewind:
$ rvm ruby-2.2 do ruby -e "f1 = File.open('pom.xml'); f2 = File.open('tmp.txt', 'r+'); IO.copy_stream(f1, f2); p f2.eof?, f2.pos"
true
24619
I mean, I wouldn't normally expect that
IO.copy_stream
would rewind the destination, but MRI does it, and we're currently relying on that behaviour in Refile (although we will add the rewind now). Just to help you to be the closest to MRI :)The text was updated successfully, but these errors were encountered: