Describe the bug
On macOS[^1], the crossterm::event::poll function fails when a timeout larger than 100 million seconds is specified. The error returned is not helpful in resolving the issue:
Accepts a timeval whose tv_sec field is a time_t, which on 64-bit macOS is an int64_t
Returns EINVAL for timeval->tv_sec greater than 100,000,000.
Calling poll() with a very large duration is clearly a misuse of the poll/read() API but it might be nice to make the error message more ergonomic. Absolutely no hard feelings if this is EWONTFIX, though.
[^1]: All versions, as far as I know.
To Reproduce
let _ = crossterm::event::poll(std::time::Duration::MAX).unwrap();
Expected behavior
Crossterm could handle this edge case and produce an error message that helps the developer. For example, there was much confusion and discussion when it was encountered in https://github.com/altsem/gitu/issues/22.
Describe the bug On macOS[^1], the
crossterm::event::poll
function fails when a timeout larger than 100 million seconds is specified. The error returned is not helpful in resolving the issue:This happens because macOS's
select(2)
syscall:timeval
whosetv_sec
field is atime_t
, which on 64-bit macOS is anint64_t
EINVAL
fortimeval->tv_sec
greater than 100,000,000.Calling
poll()
with a very large duration is clearly a misuse of thepoll/read()
API but it might be nice to make the error message more ergonomic. Absolutely no hard feelings if this isEWONTFIX
, though.[^1]: All versions, as far as I know.
To Reproduce
The maximum value of
tv_sec
was confirmed using this very sloppy C code.Expected behavior Crossterm could handle this edge case and produce an error message that helps the developer. For example, there was much confusion and discussion when it was encountered in https://github.com/altsem/gitu/issues/22.
OS macOS (all versions AFAIK)
Terminal/Console n/a