diff options
author | Eric Wong <e@80x24.org> | 2015-09-14 05:33:16 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2015-09-14 05:34:18 +0000 |
commit | db790ff3531acdfa23ab290998bba29360a6782b (patch) | |
tree | 7326eb39c42abc10717337a677cff505a29fd05d | |
parent | 3358447d32b70e96f6cd48f05967306eafbc00d0 (diff) | |
download | rainbows-db790ff3531acdfa23ab290998bba29360a6782b.tar.gz |
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]
-rw-r--r-- | lib/rainbows/sync_close.rb | 12 |
1 files 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 |