From: "matz (Yukihiro Matsumoto) via ruby-core" Date: 2026-11-18T05:30:12+00:00 Subject: [ruby-core:127569] [Ruby Bug#22424] IO#readpartial and IO#sysread should respect IO#timeout= value Issue #22424 has been updated by matz (Yukihiro Matsumoto). I agree that `IO#readpartial` should respect `IO#timeout=`, as `IO#read` and `IO#gets` do. Please go ahead with that part. I am not sure about `IO#sysread`. It is a method for calling read(2) directly, and I hesitate to add extra behavior to it. Is there a concrete case where you need the timeout in `sysread` itself, instead of waiting with `IO#wait_readable` beforehand? Matz. ---------------------------------------- Bug #22424: IO#readpartial and IO#sysread should respect IO#timeout= value https://bugs.ruby-lang.org/issues/22424#change-120079 * Author: rhenium (Kazuki Yamaguchi) * Status: Open * Backport: 3.3: UNKNOWN, 3.4: REQUIRED, 4.0: REQUIRED ---------------------------------------- I expected `IO#readpartial` and `IO#sysread` to respect `IO#timeout=` and raise `IO::TimeoutError`, but they currently ignore it and block indefinitely: ```ruby 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 commit:e4f91bbdbaa6ab3125f24967414ac5300bb244f5 (the original commit that added `IO#timeout=`, [Feature #18630]). -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/