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 | 0373c5e51c93d9b067e012e19ee6ab4e12162bf9 (patch) | |
| tree | 7ec80a344dbe5a18e61c4f104fefee8e8f056d4d /lib/timeout.rb | |
| parent | ab69bf24bc05ce9f190ed16e86c406aa418d3e74 (diff) | |
| download | ruby-0373c5e51c93d9b067e012e19ee6ab4e12162bf9.tar.gz ruby-0373c5e51c93d9b067e012e19ee6ab4e12162bf9.tar.xz ruby-0373c5e51c93d9b067e012e19ee6ab4e12162bf9.zip | |
* lib/timeout.rb: add optional exception argument for compatibility
function.
git-svn-id: http://svn.ruby-lang.org/repos/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 00e60aff8..f5c4e3cbf 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 |
