Issue #12280 has been updated by Yui NARUSE.


Benoit Daloze wrote:
> For me, having a message like:
> "NotImplementedError: IO.copy_stream with offset is not supported on Windows since it is not atomic"
> would be a good enough fix for this.

IO.copy_stream is a utility method.
It works as expected and fast if there's a suitable API like sendfile.

On this precondition, IO.copy_stream should work even on Windows.
You can simply acquire GVL or fine grained lock to achieve multithread safety.

Anyway you can provide pread with ReadFile.
You may know, on Windows read() is our own function and the real name is rb_w32_read.
You can implement rb_w32_pread with ReadFile in win32/win32.c.

----------------------------------------
Bug #12280: IO.copy_stream(IO, IO) fails with "pread() not implemented"
https://bugs.ruby-lang.org/issues/12280#change-58347

* Author: Benoit Daloze
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: 
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
IO.copy_stream on Windows with IO having an offset fails with:
NotImplementedError: pread() not implemented

This seems suboptimal, should a clearer be reported?
Is it a platform limitation?



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>