1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/timeout] Only run timeout_after hook on fiber scheduler if scheduler exists

https://github.com/ruby/timeout/commit/4893cde0ed
This commit is contained in:
Jeremy Evans 2021-05-03 08:38:54 -07:00 committed by Hiroshi SHIBATA
parent 44e8575ca6
commit 120b835fae

View file

@ -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