You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
On macOS1, 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.
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 altsem/gitu#22.
The text was updated successfully, but these errors were encountered:
overhacked
changed the title
crossterm::event::poll function fails on macOS with a timeout larger than 4_294_967_355u64 secondscrossterm::event::poll function fails on macOS with a timeout larger than 100 million seconds
Mar 5, 2024
Describe the bug
On macOS1, 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.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 altsem/gitu#22.
OS
macOS (all versions AFAIK)
Terminal/Console
n/a
Footnotes
All versions, as far as I know. ↩
The text was updated successfully, but these errors were encountered: