summaryrefslogtreecommitdiff
path: root/lib/rubygems
diff options
context:
space:
mode:
authorDavid Rodríguez <[email protected]>2024-12-16 19:18:34 +0100
committerHiroshi SHIBATA <[email protected]>2024-12-18 10:05:21 +0900
commitb9ad8fa52454e0dc7db2a4a617daecf5fa7d5bdb (patch)
tree62fa31cbe7c0f6ecdf427833b44dbf79b0b1fc6e /lib/rubygems
parent498d6eb114c52bd16a6821029959e88ed8f87396 (diff)
Bump vendored timeout to 0.4.3
Diffstat (limited to 'lib/rubygems')
-rw-r--r--lib/rubygems/vendor/timeout/lib/timeout.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/rubygems/vendor/timeout/lib/timeout.rb b/lib/rubygems/vendor/timeout/lib/timeout.rb
index cb14fa6622..455c504f47 100644
--- a/lib/rubygems/vendor/timeout/lib/timeout.rb
+++ b/lib/rubygems/vendor/timeout/lib/timeout.rb
@@ -20,7 +20,7 @@
module Gem::Timeout
# The version
- VERSION = "0.4.2"
+ VERSION = "0.4.3"
# Internal error raised to when a timeout is triggered.
class ExitException < Exception
@@ -141,9 +141,10 @@ module Gem::Timeout
# Perform an operation in a block, raising an error if it takes longer than
# +sec+ seconds to complete.
#
- # +sec+:: Number of seconds to wait for the block to terminate. Any number
- # may be used, including Floats to specify fractional seconds. A
+ # +sec+:: Number of seconds to wait for the block to terminate. Any non-negative number
+ # or nil may be used, including Floats to specify fractional seconds. A
# value of 0 or +nil+ will execute the block without any timeout.
+ # Any negative number will raise an ArgumentError.
# +klass+:: Exception Class to raise if the block fails to terminate
# in +sec+ seconds. Omitting will use the default, Gem::Timeout::Error
# +message+:: Error message to raise with Exception Class.
@@ -165,6 +166,7 @@ module Gem::Timeout
# a module method, so you can call it directly as Gem::Timeout.timeout().
def timeout(sec, klass = nil, message = nil, &block) #:yield: +sec+
return yield(sec) if sec == nil or sec.zero?
+ raise ArgumentError, "Timeout sec must be a non-negative number" if 0 > sec
message ||= "execution expired"