summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/timeout.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/timeout.rb b/lib/timeout.rb
index 00e60aff8c3..f5c4e3cbf05 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