diff options
author | CosmicOppai <[email protected]> | 2024-10-14 14:45:33 +0530 |
---|---|---|
committer | git <[email protected]> | 2024-12-03 06:49:53 +0000 |
commit | 203a02344766bdab347c82e7fd082248cad38364 (patch) | |
tree | aad293f7cbb4bd51485e067a20c87c9b89c8a2bd /lib | |
parent | de50236c3a06690522f88534309ab335090a37f7 (diff) |
[ruby/timeout] added the check for negative sec
https://github.com/ruby/timeout/commit/8e57887eee
Diffstat (limited to 'lib')
-rw-r--r-- | lib/timeout.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/timeout.rb b/lib/timeout.rb index bf12f37382..c8c3d501b6 100644 --- a/lib/timeout.rb +++ b/lib/timeout.rb @@ -164,6 +164,7 @@ module Timeout # Timeout</tt> into your classes so they have a #timeout method, as well as # a module method, so you can call it directly as Timeout.timeout(). def timeout(sec, klass = nil, message = nil, &block) #:yield: +sec+ + raise ArgumentError, "Timeout sec must be a positive number" unless sec.is_a?(Numeric) && sec >= 0 return yield(sec) if sec == nil or sec.zero? message ||= "execution expired" |