Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extended logging for debugging readline failures. #4722

Merged
merged 1 commit into from Aug 9, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 7 additions & 4 deletions test/readline/test_readline.rb
Expand Up @@ -496,7 +496,8 @@ def test_interrupt_in_other_thread
begin
Thread.new{
trap(:INT) {
p :INT
puts 'TRAP'
$stdout.flush
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aycabta I wonder if there is some problem here. I noticed that #flush was necessary to make it pass locally. I wonder if this is part of the problem we are seeing on Readline 7.0.

}
Readline.readline('input> ')
exit!(0) # Cause the process to exit immediately.
Expand All @@ -520,13 +521,15 @@ def test_interrupt_in_other_thread
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.
Expand All @@ -540,8 +543,8 @@ def test_interrupt_in_other_thread
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
Expand Down