diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-07-03 14:44:46 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-07-03 14:44:46 +0000 |
commit | 554f524ee53c8f924c739867608ed7a147aa920e (patch) | |
tree | 7ec80a344dbe5a18e61c4f104fefee8e8f056d4d /lib/timeout.rb | |
parent | 40f3699376a5df74b82f6c1b5e7eb32cd75d5d17 (diff) |
* 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
Diffstat (limited to 'lib/timeout.rb')
-rw-r--r-- | lib/timeout.rb | 7 |
1 files changed, 5 insertions, 2 deletions
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 |