Skip to content

IO.copy_stream doesn't rewind the destination #2762

Closed
@janko

Description

@janko

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.0
require "stringio"
require "tempfile"
file = Tempfile.new('foo')
IO.copy_stream(StringIO.new('foo'), file)
file.eof? #=> false (it's on the beginning)
# JRuby 9.0.0.0.pre1
require "stringio"
require "tempfile"
file = Tempfile.new('foo')
IO.copy_stream(StringIO.new('foo'), file)
file.eof? #=> true

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions