From: "usa (Usaku NAKAMURA)" Date: 2012-07-27T16:50:52+09:00 Subject: [ruby-core:46803] [ruby-trunk - Bug #5954] IO.read_nonblock on IO.pipe generates Errno::EBADF (MinGW) Issue #5954 has been updated by usa (Usaku NAKAMURA). Target version changed from 1.9.3 to 3.0 ---------------------------------------- Bug #5954: IO.read_nonblock on IO.pipe generates Errno::EBADF (MinGW) https://bugs.ruby-lang.org/issues/5954#change-28473 Author: luislavena (Luis Lavena) Status: Assigned Priority: Normal Assignee: usa (Usaku NAKAMURA) Category: Target version: 3.0 ruby -v: 1.9.3-p0 i386-mingw32 and 2.0.0dev Originally posted in [ruby-core:42103]: The following example seems not to work under Windows: =begin r, w = IO.pipe w.write "awesome" * 10 puts r.read_nonblock(8) r.close w.close =end C:\Users\Luis>ruby -v t.rb ruby 1.9.3p0 (2011-10-30) [i386-mingw32] t.rb:5:in `read_nonblock': Bad file descriptor (Errno::EBADF) from t.rb:5:in `
' What is not clear is that using StringIO works: =begin require "stringio" b = StringIO.new b.write "awesome" * 10 b.rewind puts b.read_nonblock(8) b.close =end C:\Users\Luis>ruby -v t2.rb ruby 1.9.3p0 (2011-10-30) [i386-mingw32] awesomea Perhaps pipes are not open properly? Is this supported under Windows? -- http://bugs.ruby-lang.org/