Project

General

Profile

Bug #5954

IO.read_nonblock on IO.pipe generates Errno::EBADF (MinGW)

Added by Luis Lavena almost 5 years ago. Updated over 3 years ago.

Status:
Rejected
Priority:
Normal
ruby -v:
1.9.3-p0 i386-mingw32 and 2.0.0dev
Backport:
[ruby-core:42295]

Description

=begin
Originally posted in :

The following example seems not to work under Windows:

r, w = IO.pipe

w.write "awesome" * 10

puts r.read_nonblock(8)

r.close
w.close

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:

require "stringio"

b = StringIO.new

b.write "awesome" * 10
b.rewind

puts b.read_nonblock(8)

b.close

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?
=end

History

#1 Updated by Shyouhei Urabe over 4 years ago

  • Status changed from Open to Assigned

#2 [ruby-core:46803] Updated by Usaku NAKAMURA over 4 years ago

  • Target version changed from 1.9.3 to Next Major

#3 [ruby-core:47048] Updated by Nobuyoshi Nakada over 4 years ago

  • Description updated (diff)

#4 [ruby-core:56210] Updated by Luis Lavena over 3 years ago

Hello usa, nobu.

I've hit this issue with several project again.

Can you confirm or reject if this failure is intended or a bug? That way I can decide jump into the code or not (as IO is not my strongest field)

Thank you.

#5 [ruby-core:56237] Updated by Nobuyoshi Nakada over 3 years ago

It's natural.
Windows doesn't support non-blocking mode on other than sockets.

#6 [ruby-core:56361] Updated by Luis Lavena over 3 years ago

  • Status changed from Assigned to Rejected

Thank you nobu, this is a platform limitation then.

Also available in: Atom PDF