IO.copy_stream does not advance Tempfile destination
The following script, reported to JRuby in https://github.com/jruby/jruby/issues/2762, shows that MRI does not advance the position of a
Tempfile when using
require "stringio" require "tempfile" file = Tempfile.new('foo') IO.copy_stream(StringIO.new('foo'), file) file.eof? #=> false (it's on the beginning)
Other types of streams leave the destination where it is after the copy, so I believe this is a bug.
Updated by nobu (Nobuyoshi Nakada) almost 5 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
Applied in changeset r50118.
io.c: use read/write methods if possible
- io.c (copy_stream_body): use the arguments without conversion if having read, readpartial, and write methods, than conversion by to_path method. [ruby-core:68676] [Bug #11015]