From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS8972 188.138.9.0/24 X-Spam-Status: No, score=-1.3 required=3.0 tests=AWL,BAYES_05,RCVD_IN_XBL shortcircuit=no autolearn=no version=3.3.2 X-Original-To: rainbows-public@bogomips.org Received: from 80x24.org (atlantic480.us.unmetered.com [188.138.9.49]) by dcvr.yhbt.net (Postfix) with ESMTP id 23CFD1F7DF for ; Mon, 14 Sep 2015 05:33:37 +0000 (UTC) From: Eric Wong To: rainbows-public@bogomips.org Subject: [PATCH 4/6] sync_close: This fix breakage from Ruby-trunk r50118 Date: Mon, 14 Sep 2015 05:33:16 +0000 Message-Id: <20150914053318.12251-5-e@80x24.org> In-Reply-To: <20150914053318.12251-1-e@80x24.org> References: <20150914053318.12251-1-e@80x24.org> List-Id: 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 -- EW