From 120b835fae2832ded4a02d3fcfc70749cad9d177 Mon Sep 17 00:00:00 2001 From: Jeremy Evans Date: Mon, 3 May 2021 08:38:54 -0700 Subject: [PATCH] [ruby/timeout] Only run timeout_after hook on fiber scheduler if scheduler exists https://github.com/ruby/timeout/commit/4893cde0ed --- lib/timeout.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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