diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | lib/timeout.rb | 7 |
2 files changed, 10 insertions, 2 deletions
@@ -1,3 +1,8 @@ +Thu Jul 3 23:41:30 2003 Tanaka Akira <[email protected]> + + * lib/timeout.rb: add optional exception argument for compatibility + function. + Thu Jul 3 14:22:46 2003 Yukihiro Matsumoto <[email protected]> * array.c (rb_values_at): extract common procedure from 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 |