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
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.

View File

@ -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

View File

@ -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

View File

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

View File

@ -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

View File

@ -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

View File

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

View File

@ -3,7 +3,6 @@
require 'test/unit'
require 'tempfile'
require 'timeout'
require 'io/wait'
require 'rbconfig'
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 $
require 'io/wait'
require_relative 'server'
require_relative 'httputils'
require_relative 'httpstatus'