From 67e06102a3c8d0b8e8ff7a6f0528016f2560fd4b Mon Sep 17 00:00:00 2001 From: aycabta Date: Tue, 10 Aug 2021 06:54:32 +0900 Subject: Stop checking char from "read" Because it's sometimes nil due to race condition. --- test/readline/test_readline.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'test/readline') diff --git a/test/readline/test_readline.rb b/test/readline/test_readline.rb index 3661aace15..c0f1b30925 100644 --- a/test/readline/test_readline.rb +++ b/test/readline/test_readline.rb @@ -520,14 +520,16 @@ module BasetestReadline EnvUtil.invoke_ruby(["-I#{__dir__}", script.path], "", true, :merge_to_stdout) do |_in, _out, _, pid| Timeout.timeout(TIMEOUT) do log << "** START **" - while c = _out.read(1) + loop do + c = _out.read(1) log << c if c break if log.include?('input>') end log << "** SIGINT **" Process.kill(:INT, pid) sleep 0.1 - while c = _out.read(1) + loop do + c = _out.read(1) log << c if c break if log.include?('TRAP') end @@ -537,7 +539,8 @@ module BasetestReadline rescue Errno::EPIPE # The "write" will fail if Reline crashed by SIGINT. end - while c = _out.read(1) + loop do + c = _out.read(1) log << c if c if log.include?('FAILED') assert false, "Should handle SIGINT correctly but raised interrupt.\nLog: #{log}\n----" -- cgit v1.2.3