天天看點

Terminator超錯誤的問題

http://github.com/jeremyd/terminator

terminator據說這定時的比較準,不過惡心的事,作者Readme上寫的例子不對,這Timeout錯誤一直沒有捕獲到

今天試了下,如下的代碼可以擷取的到這個錯誤

require "rubygems"

require "terminator"

def xx

raise "Other error"

end

Terminator.terminate 1 do

begin

    xx

rescue Terminator::Error

p "timeout error"

rescue

p "Other error"

先暫時這樣,至于為什麼隻在裡面才有用,以後再探求

繼續閱讀