snipplets.dev/code/Crystal/prompt_timeout.cr

3 lines
77 B
Crystal
Raw Normal View History

2022-07-31 03:04:43 +03:00
STDIN.read_timeout = 1
STDIN.gets # raises IO::TimeoutError (after 1 second)