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"
end
end

先暫時這樣,至於爲什麼只在裏面纔有用,以後再探求
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章