snipplets.dev/code/Crystal/prompt_timeout.cr
2023-09-26 22:05:13 +03:00

3 lines
77 B
Crystal

STDIN.read_timeout = 1
STDIN.gets # raises IO::TimeoutError (after 1 second)