diff options
-rw-r--r-- | ext/socket/lib/socket.rb | 6 | ||||
-rw-r--r-- | spec/ruby/library/io-wait/wait_readable_spec.rb | 4 | ||||
-rw-r--r-- | spec/ruby/library/io-wait/wait_writable_spec.rb | 4 | ||||
-rw-r--r-- | test/-ext-/thread_fd/test_thread_fd_close.rb | 1 | ||||
-rw-r--r-- | test/io/wait/test_io_wait.rb | 7 | ||||
-rw-r--r-- | test/io/wait/test_io_wait_uncommon.rb | 1 | ||||
-rw-r--r-- | test/io/wait/test_ractor.rb | 1 | ||||
-rw-r--r-- | test/ruby/test_process.rb | 1 | ||||
-rw-r--r-- | tool/lib/webrick/httpserver.rb | 1 |
9 files changed, 14 insertions, 12 deletions
diff --git a/ext/socket/lib/socket.rb b/ext/socket/lib/socket.rb index 1c091650ff..eecdc7d4b8 100644 --- a/ext/socket/lib/socket.rb +++ b/ext/socket/lib/socket.rb @@ -1,7 +1,11 @@ # frozen_string_literal: true require 'socket.so' -require 'io/wait' unless ::IO.method_defined?(:wait_readable, false) + +unless IO.method_defined?(:wait_writable, false) + # It's only required on older Rubies < v3.2: + require 'io/wait' +end class Addrinfo # creates an Addrinfo object from the arguments. diff --git a/spec/ruby/library/io-wait/wait_readable_spec.rb b/spec/ruby/library/io-wait/wait_readable_spec.rb index 48e0b4ef7d..06ffbda5c8 100644 --- a/spec/ruby/library/io-wait/wait_readable_spec.rb +++ b/spec/ruby/library/io-wait/wait_readable_spec.rb @@ -1,6 +1,8 @@ require_relative '../../spec_helper' -require 'io/wait' +ruby_version_is ''...'3.2' do + require 'io/wait' +end describe "IO#wait_readable" do before :each do diff --git a/spec/ruby/library/io-wait/wait_writable_spec.rb b/spec/ruby/library/io-wait/wait_writable_spec.rb index 5900a0c566..8c44780d39 100644 --- a/spec/ruby/library/io-wait/wait_writable_spec.rb +++ b/spec/ruby/library/io-wait/wait_writable_spec.rb @@ -1,6 +1,8 @@ require_relative '../../spec_helper' -require 'io/wait' +ruby_version_is ''...'3.2' do + require 'io/wait' +end describe "IO#wait_writable" do it "waits for the IO to become writable with no timeout" do diff --git a/test/-ext-/thread_fd/test_thread_fd_close.rb b/test/-ext-/thread_fd/test_thread_fd_close.rb index a53949b93b..1d2ef63635 100644 --- a/test/-ext-/thread_fd/test_thread_fd_close.rb +++ b/test/-ext-/thread_fd/test_thread_fd_close.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true require 'test/unit' require '-test-/thread_fd' -require 'io/wait' class TestThreadFdClose < Test::Unit::TestCase diff --git a/test/io/wait/test_io_wait.rb b/test/io/wait/test_io_wait.rb index 8a2b6c2d12..7997a4814f 100644 --- a/test/io/wait/test_io_wait.rb +++ b/test/io/wait/test_io_wait.rb @@ -3,10 +3,9 @@ require 'test/unit' require 'timeout' require 'socket' -begin - require 'io/wait' -rescue LoadError -end + +# For `IO#ready?` and `IO#nread`: +require 'io/wait' class TestIOWait < Test::Unit::TestCase diff --git a/test/io/wait/test_io_wait_uncommon.rb b/test/io/wait/test_io_wait_uncommon.rb index 7b92e4c758..0f922f4e24 100644 --- a/test/io/wait/test_io_wait_uncommon.rb +++ b/test/io/wait/test_io_wait_uncommon.rb @@ -1,6 +1,5 @@ # frozen_string_literal: true require 'test/unit' -require 'io/wait' # test uncommon device types to check portability problems # We may optimize IO#wait_*able for non-Linux kernels in the future diff --git a/test/io/wait/test_ractor.rb b/test/io/wait/test_ractor.rb index 3742680cf7..800216e610 100644 --- a/test/io/wait/test_ractor.rb +++ b/test/io/wait/test_ractor.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true require 'test/unit' require 'rbconfig' -require 'io/wait' class TestIOWaitInRactor < Test::Unit::TestCase def test_ractor diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb index 8a501b0624..1d04d22631 100644 --- a/test/ruby/test_process.rb +++ b/test/ruby/test_process.rb @@ -3,7 +3,6 @@ require 'test/unit' require 'tempfile' require 'timeout' -require 'io/wait' require 'rbconfig' class TestProcess < Test::Unit::TestCase diff --git a/tool/lib/webrick/httpserver.rb b/tool/lib/webrick/httpserver.rb index e85d059319..f3f948da3b 100644 --- a/tool/lib/webrick/httpserver.rb +++ b/tool/lib/webrick/httpserver.rb @@ -9,7 +9,6 @@ # # $IPR: httpserver.rb,v 1.63 2002/10/01 17:16:32 gotoyuzo Exp $ -require 'io/wait' require_relative 'server' require_relative 'httputils' require_relative 'httpstatus' |