snipplets.dev/snipplets/code/Crystal/prompt_timeout.cr
2023-08-05 22:45:06 +03:00

3 lines
77 B
Crystal

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