Skip to content

Don't require io/wait on Ruby 3.2 and higher - #61

Open
headius wants to merge 1 commit into
ruby:masterfrom
headius:no_io_wait
Open

headius wants to merge 1 commit into
ruby:masterfrom
headius:no_io_wait

Conversation

@headius

@headius headius commented Sep 15, 2026

Copy link
Copy Markdown

io/wait functionality has been in core Ruby since 3.2 and prior to that was a default gem. With the "1.0.0" release of io-wait it is now deprecated and warns when loaded. This patch removes the last reference to the io/wait library to avoid deprecation warnings.

See ruby/io-wait#79 and ruby/io-wait#80

@headius

headius commented Sep 15, 2026

Copy link
Copy Markdown
Author

I noticed this gem specifies a minimum Ruby of 2.7, at which time io-wait was still in core. It was moved out to a default gem (still in stdlib) for 3.0 and 3.1, and then moved back into core for 3.2. the gem itself has had an empty extension for some time.

@headius

headius commented Sep 15, 2026

Copy link
Copy Markdown
Author

For 2.7, 3.0, and 3.1, the require is still necessary to load the library. If you would like I can guard this require with a version check, if those versions are still considered to be supported.

io/wait functionality has been in core Ruby since 3.2. It was a
default gem in 3.0 and 3.1 and before that it was a non-gem
standard library. With the "1.0.0" release of io-wait it is now
deprecated and warns when loaded. This patch modifies the require
to only run under Ruby versions earlier than 3.2.

See ruby/io-wait#79 and ruby/io-wait#80
@headius headius changed the title Don't require io/wait Don't require io/wait on Ruby 3.2 and higher Sep 15, 2026
@headius

headius commented Sep 15, 2026

Copy link
Copy Markdown
Author

I modified the commit to continue requiring io/wait on Ruby versions earlier than 3.2.

@sampokuokkanen

sampokuokkanen commented Sep 15, 2026

Copy link
Copy Markdown

Actually socket.rb seems to require it on Rubies below 3.2: https://github.com/ruby/ruby/blob/0a3704f218f0aec7f92f3a46a2293175b0a7d2b3/ext/socket/lib/socket.rb#L4

So might not even need the if RUBY_VERSION < '3.2' check.

@headius

headius commented Sep 15, 2026

Copy link
Copy Markdown
Author

I believe it's possible to run drb over non-socket IO channels, so the require would need to remain for that use case. I am not an expert on drb though.

In general I'd say it's better if everyone that depends on the library's features explicitly require that library, even if it becomes redundant across libraries.

This branch was successfully deployed

1 active deployment
release 73da14a5 Deployed Sep 15, 2026 by headius via RubyGems #58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants