Remove require 'io/wait' where it's no longer necessary. (#6932)

* Remove `require 'io/wait'` as it's part of core now.

* Update ruby specs using version gates.

* Add note about why it's conditional.
This commit is contained in:
Samuel Williams 2022-12-15 11:37:01 +13:00 committed by GitHub
parent 55f56eb66e
commit d20bd06a97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
Notes: git 2022-12-14 22:37:22 +00:00
Merged-By: ioquatix <samuel@codeotaku.com>
9 changed files with 14 additions and 12 deletions

View File

@ -1,7 +1,11 @@
# frozen_string_literal: true # frozen_string_literal: true
require 'socket.so' 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 class Addrinfo
# creates an Addrinfo object from the arguments. # creates an Addrinfo object from the arguments.

View File

@ -1,6 +1,8 @@
require_relative '../../spec_helper' require_relative '../../spec_helper'
require 'io/wait' ruby_version_is ''...'3.2' do
require 'io/wait'
end
describe "IO#wait_readable" do describe "IO#wait_readable" do
before :each do before :each do

View File

@ -1,6 +1,8 @@
require_relative '../../spec_helper' require_relative '../../spec_helper'
require 'io/wait' ruby_version_is ''...'3.2' do
require 'io/wait'
end
describe "IO#wait_writable" do describe "IO#wait_writable" do
it "waits for the IO to become writable with no timeout" do it "waits for the IO to become writable with no timeout" do

View File

@ -1,7 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
require 'test/unit' require 'test/unit'
require '-test-/thread_fd' require '-test-/thread_fd'
require 'io/wait'
class TestThreadFdClose < Test::Unit::TestCase class TestThreadFdClose < Test::Unit::TestCase

View File

@ -3,10 +3,9 @@
require 'test/unit' require 'test/unit'
require 'timeout' require 'timeout'
require 'socket' require 'socket'
begin
require 'io/wait' # For `IO#ready?` and `IO#nread`:
rescue LoadError require 'io/wait'
end
class TestIOWait < Test::Unit::TestCase class TestIOWait < Test::Unit::TestCase

View File

@ -1,6 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
require 'test/unit' require 'test/unit'
require 'io/wait'
# test uncommon device types to check portability problems # test uncommon device types to check portability problems
# We may optimize IO#wait_*able for non-Linux kernels in the future # We may optimize IO#wait_*able for non-Linux kernels in the future

View File

@ -1,7 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
require 'test/unit' require 'test/unit'
require 'rbconfig' require 'rbconfig'
require 'io/wait'
class TestIOWaitInRactor < Test::Unit::TestCase class TestIOWaitInRactor < Test::Unit::TestCase
def test_ractor def test_ractor

View File

@ -3,7 +3,6 @@
require 'test/unit' require 'test/unit'
require 'tempfile' require 'tempfile'
require 'timeout' require 'timeout'
require 'io/wait'
require 'rbconfig' require 'rbconfig'
class TestProcess < Test::Unit::TestCase class TestProcess < Test::Unit::TestCase

View File

@ -9,7 +9,6 @@
# #
# $IPR: httpserver.rb,v 1.63 2002/10/01 17:16:32 gotoyuzo Exp $ # $IPR: httpserver.rb,v 1.63 2002/10/01 17:16:32 gotoyuzo Exp $
require 'io/wait'
require_relative 'server' require_relative 'server'
require_relative 'httputils' require_relative 'httputils'
require_relative 'httpstatus' require_relative 'httpstatus'