truffleruby
truffleruby copied to clipboard
[Compatibility] Adding IO#timeout
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.