truffleruby icon indicating copy to clipboard operation
truffleruby copied to clipboard

[Compatibility] Adding IO#timeout

Open itarato opened this issue 1 year ago • 0 comments

Source: https://github.com/oracle/truffleruby/issues/3039

Introduce IO#timeout= and IO#timeout which can cause IO::TimeoutError to be raised if a blocking operation exceeds the specified timeout. [Feature #18630]

STDIN.timeout = 1
STDIN.read # => Blocking operation timed out! (IO::TimeoutError)

Caveat

This PR does not contain updating the error type for TCPSocket #open and #new. It seems we don't have the whole timeout logic implemented for that yet. I rather have them implemented in a separate PR to keep it clean.

itarato avatar May 25 '23 20:05 itarato