Force enter in gets

Hi all,

Let’s say I have a ruby script that gets some user input:

name = gets

How can I make it so after 10 seconds of no input (or even if they start
typing, it’ll cut them off after 10 seconds) it will continue? In other
words, essentially simulate the return key after 10 seconds.

Hi,

Am Freitag, 25. Sep 2009, 01:35:46 +0900 schrieb Jack B.:

Let’s say I have a ruby script that gets some user input:

name = gets

How can I make it so after 10 seconds of no input (or even if they start
typing, it’ll cut them off after 10 seconds) it will continue? In other
words, essentially simulate the return key after 10 seconds.

name = if select [$stdin], nil, nil, 10 then gets else “Joe” end

Bertram