From: "shyouhei (Shyouhei Urabe)" Date: 2022-06-29T08:02:10+00:00 Subject: [ruby-core:109091] [Ruby master Bug#18881] IO#read_nonblock raises IOError when called following buffered character IO Issue #18881 has been updated by shyouhei (Shyouhei Urabe). Basically yes. Some edge cases can be considered though (e.g. IO#flush could also reset this, IO#pread could be special-case allowed (avoiding IO#seek is the reason for this method to exist), etc). ---------------------------------------- Bug #18881: IO#read_nonblock raises IOError when called following buffered character IO https://bugs.ruby-lang.org/issues/18881#change-98237 * Author: javanthropus (Jeremy Bopp) * Status: Rejected * Priority: Normal * ruby -v: ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x64-mingw-ucrt] * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN ---------------------------------------- The following example code works as expected on Linux but raises an `IOError` on Windows: ``` ruby r, w = IO.pipe w.write("foobar") c = r.getc r.ungetc(c) r.read_nonblock(3) ``` The error message is: ``` IOError: byte oriented read for character buffered IO ``` -- https://bugs.ruby-lang.org/ Unsubscribe: