Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 675adb21cc0e
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 164cdedfb6ad
Choose a head ref
  • 3 commits
  • 2 files changed
  • 1 contributor

Commits on Feb 9, 2017

  1. Copy the full SHA
    cb69360 View commit details

Commits on Feb 13, 2017

  1. Copy the full SHA
    8bd3949 View commit details
  2. Merge pull request #4486 from headius/fix-ewouldblock-waitreadable

    Set up EWOULDBLOCKWaitReadable/Writable if not present. Fix #4473
    headius authored Feb 13, 2017
    Copy the full SHA
    164cded View commit details
Showing with 57 additions and 0 deletions.
  1. +13 −0 core/src/main/ruby/jruby/kernel/io.rb
  2. +44 −0 spec/ruby/core/exception/io_error_spec.rb
13 changes: 13 additions & 0 deletions core/src/main/ruby/jruby/kernel/io.rb
Original file line number Diff line number Diff line change
@@ -7,6 +7,19 @@ class EAGAINWaitWritable < Errno::EAGAIN
include IO::WaitWritable
end

if Errno::EAGAIN == Errno::EWOULDBLOCK
IO::EWOULDBLOCKWaitReadable = IO::EAGAINWaitReadable
IO::EWOULDBLOCKWaitWritable = IO::EAGAINWaitWritable
else
class EWOULDBLOCKWaitReadable < Errno::EWOULDBLOCK
include IO::WaitReadable
end

class EWOULDBLOCKWaitWritable < Errno::EWOULDBLOCK
include IO::WaitWritable
end
end

class EINPROGRESSWaitWritable < Errno::EINPROGRESS
include IO::WaitWritable
end
44 changes: 44 additions & 0 deletions spec/ruby/core/exception/io_error_spec.rb
Original file line number Diff line number Diff line change
@@ -5,3 +5,47 @@
IOError.should be_ancestor_of(EOFError)
end
end

describe "IO::EAGAINWaitReadable" do
it "combines Errno::EAGAIN and IO::WaitReadable" do
IO::EAGAINWaitReadable.superclass.should == Errno::EAGAIN
IO::EAGAINWaitReadable.ancestors.should include IO::WaitReadable
end

it "is the same as IO::EWOULDBLOCKWaitReadable if Errno::EAGAIN is the same as Errno::EWOULDBLOCK" do
if Errno::EAGAIN.equal? Errno::EWOULDBLOCK
IO::EAGAINWaitReadable.should equal IO::EWOULDBLOCKWaitReadable
else
IO::EAGAINWaitReadable.should_not equal IO::EWOULDBLOCKWaitReadable
end
end
end

describe "IO::EWOULDBLOCKWaitReadable" do
it "combines Errno::EWOULDBLOCK and IO::WaitReadable" do
IO::EWOULDBLOCKWaitReadable.superclass.should == Errno::EWOULDBLOCK
IO::EAGAINWaitReadable.ancestors.should include IO::WaitReadable
end
end

describe "IO::EAGAINWaitWritable" do
it "combines Errno::EAGAIN and IO::WaitWritable" do
IO::EAGAINWaitWritable.superclass.should == Errno::EAGAIN
IO::EAGAINWaitWritable.ancestors.should include IO::WaitWritable
end

it "is the same as IO::EWOULDBLOCKWaitWritable if Errno::EAGAIN is the same as Errno::EWOULDBLOCK" do
if Errno::EAGAIN.equal? Errno::EWOULDBLOCK
IO::EAGAINWaitWritable.should equal IO::EWOULDBLOCKWaitWritable
else
IO::EAGAINWaitWritable.should_not equal IO::EWOULDBLOCKWaitWritable
end
end
end

describe "IO::EWOULDBLOCKWaitWritable" do
it "combines Errno::EWOULDBLOCK and IO::WaitWritable" do
IO::EWOULDBLOCKWaitWritable.superclass.should == Errno::EWOULDBLOCK
IO::EAGAINWaitWritable.ancestors.should include IO::WaitWritable
end
end