Forum: Ruby how to implement timeout on vista

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
73700e119917433681f2e8f3e4369f74?d=identicon&s=25 Li CN (alex-osu3)
on 2008-10-28 14:24
Hi all,

I am sorry if this post is duplicated.


Here is what I try to do: get input from terminal/console. If waiting
for 3 seconds and no input is given, then stop this process and print
out a message of 'Timeout!!!'

I tried 'timeout' from the library but it doesn't work.I wonder how I
implement timeout process on vista.

Thank you very much in advance,

Li
1bac2e65d64faf472cf2ebc94f0f5ee0?d=identicon&s=25 Ara Howard (ahoward)
on 2008-10-28 17:27
(Received via mailing list)
On Oct 28, 2008, at 7:23 AM, Li Chen wrote:

> implement timeout process on vista.
>
> Thank you very much in advance,
>
> Li
> --
> Posted via http://www.ruby-forum.com/.
>



gem install terminator

http://codeforpeople.com/lib/ruby/terminator/termi...

cheers.

a @ http://codeforpeople.com/
73700e119917433681f2e8f3e4369f74?d=identicon&s=25 Li CN (alex-osu3)
on 2008-10-28 23:25
Ara Howard wrote:
>
> gem install terminator
>
> http://codeforpeople.com/lib/ruby/terminator/termi...
>
> cheers.
>
> a @ http://codeforpeople.com/

Thanks.

I try terminator on my PC with Vista. I don't think it works. If I put
'input=gets' and without giving the input it will hang there for ever.

Li

#################1
C:\Users\Alex>irb
irb(main):001:0> require 'terminator'
=> true
irb(main):002:0> Terminator.terminate 1 do
irb(main):003:1* sleep 4 rescue puts 'timeout'
irb(main):004:1> end
=> 2456

################ I have to use Ctrl+break to stop the script after 2 min
were passed.

C:\Users\Alex>irb
irb(main):001:0> require 'terminator'
=> true
irb(main):002:0> Terminator.terminate 1 do
irb(main):003:1* input=gets
irb(main):004:1> sleep 4 rescue puts 'timeout'
irb(main):005:1> end
2 min pased
=> 2708
This topic is locked and can not be replied to.