From 554f524ee53c8f924c739867608ed7a147aa920e Mon Sep 17 00:00:00 2001 From: akr Date: Thu, 3 Jul 2003 14:44:46 +0000 Subject: * lib/timeout.rb: add optional exception argument for compatibility function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4034 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/timeout.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/timeout.rb b/lib/timeout.rb index 00e60aff8c..f5c4e3cbf0 100644 --- a/lib/timeout.rb +++ b/lib/timeout.rb @@ -51,8 +51,8 @@ module Timeout end # compatible -def timeout(n, &block) - Timeout::timeout(n, &block) +def timeout(n, e=Timeout::Error, &block) + Timeout::timeout(n, e, &block) end TimeoutError = Timeout::Error @@ -60,6 +60,9 @@ if __FILE__ == $0 p timeout(5) { 45 } + p timeout(5, TimeoutError) { + 45 + } p timeout(5) { loop { p 10 -- cgit v1.2.3