Project

General

Profile

Actions

Bug #22424

open

IO#readpartial and IO#sysread should respect IO#timeout= value

Bug #22424: IO#readpartial and IO#sysread should respect IO#timeout= value

Added by rhenium (Kazuki Yamaguchi) about 13 hours ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:127063]

Description

I expected IO#readpartial and IO#sysread to respect IO#timeout= and raise IO::TimeoutError, but they currently ignore it and block indefinitely:

IO.pipe{|r,w|r.timeout=1; r.read(1)} # raises IO::TimeoutError after 1 second, as expected
IO.pipe{|r,w|r.timeout=1; r.gets(1)} # raises IO::TimeoutError after 1 second, as expected

IO.pipe{|r,w|r.timeout=1; r.sysread(1)} # blocks indefinitely
IO.pipe{|r,w|r.timeout=1; r.readpartial(1)} # blocks indefinitely

This appears to be a simple omission in e4f91bbdbaa6ab3125f24967414ac5300bb244f5 (the original commit that added IO#timeout=, [Feature #18630]).

No data to display

Actions

Also available in: PDF Atom