Project

General

Profile

Actions

Bug #22413

open

IO#wait_readable does not distinguish nil from an omitted timeout

Bug #22413: IO#wait_readable does not distinguish nil from an omitted timeout

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

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

Description

I was expecting io.wait_readable(nil) to wait indefinitely, but it is currently treated the same as omitting the argumen, so the value set by IO#timeout= is used:

IO.pipe{|r,w|r.timeout=1; r.wait_readable} # returns after 1 second, as expected
IO.pipe{|r,w|r.timeout=1; r.wait_readable(nil)} # also returns after 1 second

Is this the intended behavior?

Is io.wait_readable(nil) supposed to be a valid call at all, or is nil accepted only because of a loose argument check?

The documentation for IO#wait, IO#wait_readable, and IO#wait_writable does not explain how the timeout parameter is handled.

No data to display

Actions

Also available in: PDF Atom