From db790ff3531acdfa23ab290998bba29360a6782b Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 14 Sep 2015 05:33:16 +0000 Subject: sync_close: This fix breakage from Ruby-trunk r50118 By providing read+readpartial methods IO.copy_stream behaves slightly differently when operating on non-IO-subclassed objects nowadays. Ref: > * 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] --- lib/rainbows/sync_close.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/rainbows/sync_close.rb b/lib/rainbows/sync_close.rb index 75f119e..8738cae 100644 --- a/lib/rainbows/sync_close.rb +++ b/lib/rainbows/sync_close.rb @@ -16,6 +16,14 @@ class Rainbows::SyncClose @body.respond_to?(m) end + def readpartial(*args) + @body.readpartial(*args) + end + + def read(*args) + @body.read(*args) + end + def to_path @body.to_path end @@ -31,7 +39,7 @@ class Rainbows::SyncClose # called by the writer thread to wake up the original thread (in #initialize) def close @body.close - ensure - @mutex.synchronize { @cv.signal } + ensure + @mutex.synchronize { @cv.signal } end end -- cgit v1.2.3-24-ge0c7