[前][次][番号順一覧][スレッド一覧]

ruby-changes:70524

From: aycabta <ko1@a...>
Date: Fri, 24 Dec 2021 17:12:16 +0900 (JST)
Subject: [ruby-changes:70524] f8a0ef30b2 (master): Set time limit for waiting for terminating process within a test

https://git.ruby-lang.org/ruby.git/commit/?id=f8a0ef30b2

From f8a0ef30b20207aa57cce9537babcc283d8f6a4d Mon Sep 17 00:00:00 2001
From: aycabta <aycabta@g...>
Date: Fri, 24 Dec 2021 16:26:17 +0900
Subject: Set time limit for waiting for terminating process within a test

---
 test/readline/test_readline.rb | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/test/readline/test_readline.rb b/test/readline/test_readline.rb
index f59e9ee9002..15423fd6726 100644
--- a/test/readline/test_readline.rb
+++ b/test/readline/test_readline.rb
@@ -570,8 +570,16 @@ module BasetestReadline https://github.com/ruby/ruby/blob/trunk/test/readline/test_readline.rb#L570
     rescue Timeout::Error => e
       assert false, "Timed out to handle SIGINT!\nLog: #{log}\nBacktrace:\n#{e.full_message(highlight: false)}\n----"
     ensure
-      status = Process.wait2(pid).last
-      assert status.success?, "Unknown failure with exit status #{status}\nLog: #{log}\n----"
+      status = nil
+      begin
+        Timeout.timeout(TIMEOUT) do
+          status = Process.wait2(pid).last
+        end
+      rescue Timeout::Error => e
+        Process.kill(:KILL, pid)
+        assert false, "Timed out to wait for terminating a process in a test of SIGINT!\nLog: #{log}\nBacktrace:\n#{e.full_message(highlight: false)}\n----"
+      end
+      assert status&.success?, "Unknown failure with exit status #{status.inspect}\nLog: #{log}\n----"
     end
 
     assert log.include?('INT'), "Interrupt was handled correctly."
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]