On Aug 13, 2007, at 07:04, F. Senault wrote:
> Le 13 ao?t ? 15:48, Rik Hemsley a ?crit :
>
>> The interpreter stops with the following:
>>
>> /usr/lib/ruby/1.8/timeout.rb:54: execution expired (Timeout::Error)
>>         from /usr/lib/ruby/1.8/timeout.rb:56:in `timeout'
>>         from test.rb:21
>
> Why don't you simply rescue Timeout::Error ?
>
> Timeout::timeout(1) do
>   begin
>     sleep(5)
>   rescue Timeout::Error
>     puts "rescued"
>   end
> end

You really want to subclass Timeout::Error and rescue that.  If other  
code calls yours with a timeout you have the potential for rescuing  
the outer one rather than the one you want.

See: http://blog.segment7.net/articles/2006/04/11/care-and-feeding-of- 
timeout-timeout

--
Poor workers blame their tools. Good workers build better tools. The
best workers get their tools to do the work for them. -- Syndicate Wars