From 0029155a225877ef7948fad6033a14be7a17479d Mon Sep 17 00:00:00 2001 From: Oskar Eichler Date: Thu, 27 Aug 2026 22:54:39 +0300 Subject: [PATCH] Deliver exception-construction failures to the timed-out thread --- lib/timeout.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/timeout.rb b/lib/timeout.rb index 91b04a9..cf5e635 100644 --- a/lib/timeout.rb +++ b/lib/timeout.rb @@ -168,7 +168,11 @@ def expired?(now) def interrupt @mutex.synchronize do unless @done - @thread.raise @exception_class, @message + begin + @thread.raise @exception_class, @message + rescue => error + @thread.raise error + end @done = true end end