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

ruby-changes:67089

From: Samuel <ko1@a...>
Date: Mon, 9 Aug 2021 14:03:52 +0900 (JST)
Subject: [ruby-changes:67089] 6f6a84f2f3 (master): Extended logging for debugging readline failures.

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

From 6f6a84f2f3e82f9554618f080f9b66ded52884cc Mon Sep 17 00:00:00 2001
From: Samuel Williams <samuel.williams@o...>
Date: Mon, 9 Aug 2021 14:49:52 +1200
Subject: Extended logging for debugging readline failures.

---
 test/readline/test_readline.rb | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/test/readline/test_readline.rb b/test/readline/test_readline.rb
index 3678f5b..5d76f14 100644
--- a/test/readline/test_readline.rb
+++ b/test/readline/test_readline.rb
@@ -496,7 +496,8 @@ module BasetestReadline https://github.com/ruby/ruby/blob/trunk/test/readline/test_readline.rb#L496
       begin
         Thread.new{
           trap(:INT) {
-            p :INT
+            puts 'TRAP'
+            $stdout.flush
           }
           Readline.readline('input> ')
           exit!(0) # Cause the process to exit immediately.
@@ -520,13 +521,15 @@ module BasetestReadline https://github.com/ruby/ruby/blob/trunk/test/readline/test_readline.rb#L521
           log << c if c
           break if log.include?('input>')
         end
+        log << "** SIGINT **"
         Process.kill(:INT, pid)
         sleep 0.1
         while c = _out.read(1)
           log << c if c
-          break if log.include?('INT')
+          break if log.include?('TRAP')
         end
         begin
+          log << "** NEWLINE **"
           _in.write "\n"
         rescue Errno::EPIPE
           # The "write" will fail if Reline crashed by SIGINT.
@@ -540,8 +543,8 @@ module BasetestReadline https://github.com/ruby/ruby/blob/trunk/test/readline/test_readline.rb#L543
             assert false, "Should handle SIGINT correctly but exited successfully.\nLog: #{log}\n----"
           end
         end
-      rescue Timeout::Error
-        assert false, "Timed out to handle SIGINT!\nLog: #{log}\n----"
+      rescue Timeout::Error => e
+        assert false, "Timed out to handle SIGINT!\nLog: #{log}\nBacktrace:\n#{e.full_message(highlight: false)}\n----"
       end
     ensure
       status = Process.wait2(pid).last
-- 
cgit v1.1


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

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