[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

how to implement timeout on vista

Li Chen

10/28/2008 1:24:00 PM

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
--
Posted via http://www.ruby-....

2 Answers

ara.t.howard

10/28/2008 4:26:00 PM

0


On Oct 28, 2008, at 7:23 AM, Li Chen wrote:

> 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
> --
> Posted via http://www.ruby-....
>



gem install terminator

http://codeforp...lib/ruby/terminator/terminator-0....

cheers.

a @ http://codeforp...
--
we can deny everything, except that we have the possibility of being
better. simply reflect on that.
h.h. the 14th dalai lama




Li Chen

10/28/2008 10:25:00 PM

0

Ara Howard wrote:
>
> gem install terminator
>
> http://codeforp...lib/ruby/terminator/terminator-0....
>
> cheers.
>
> a @ http://codeforp...

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

--
Posted via http://www.ruby-....