summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-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