diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-04-19 03:46:17 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-04-19 03:46:17 +0000 |
commit | 37e59f5583c781e98f41608251e094377237a133 (patch) | |
tree | 63a14f8c05e211e5fe048e06728ded36d0d7ba4d /lib | |
parent | cd08b1cbff1bc8f60c64ded8a21d57d1c58eea18 (diff) | |
download | ruby-37e59f5583c781e98f41608251e094377237a133.tar.gz |
* lib/timeout.rb (Timeout#timeout): propagate errors to the
caller. [ruby-dev:41010]'
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/timeout.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/timeout.rb b/lib/timeout.rb index 1dccc57477..297b76936c 100644 --- a/lib/timeout.rb +++ b/lib/timeout.rb @@ -46,8 +46,13 @@ module Timeout begin x = Thread.current y = Thread.start { - sleep sec - x.raise exception, "execution expired" if x.alive? + begin + sleep sec + rescue => e + x.raise e + else + x.raise exception, "execution expired" if x.alive? + end } return yield(sec) rescue exception => e |