summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2021-05-03 08:38:54 -0700
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2021-05-06 16:51:10 +0900
commit120b835fae2832ded4a02d3fcfc70749cad9d177 (patch)
tree9557cedd311a54264df8a02403bb20ac8319872f
parent44e8575ca6e7749b296366f8e7d8094e4cfd2196 (diff)
[ruby/timeout] Only run timeout_after hook on fiber scheduler if scheduler exists
https://github.com/ruby/timeout/commit/4893cde0ed
-rw-r--r--lib/timeout.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/timeout.rb b/lib/timeout.rb
index ee24349a3e..e7b11c0a86 100644
--- a/lib/timeout.rb
+++ b/lib/timeout.rb
@@ -85,7 +85,7 @@ module Timeout
message ||= "execution expired".freeze
- if (scheduler = Fiber.current_scheduler)&.respond_to?(:timeout_after)
+ if Fiber.respond_to?(:current_scheduler) && (scheduler = Fiber.current_scheduler)&.respond_to?(:timeout_after)
return scheduler.timeout_after(sec, klass || Error, message, &block)
end