From 06fb6129b0db736f51d400ccd4924f197da48323 Mon Sep 17 00:00:00 2001 From: iberianpig Date: Tue, 28 Jan 2025 23:12:25 +0900 Subject: [PATCH] Fix skipping next breakpoint unexpectedly When you reach a breakpoint in the debugger once, proceed with 'c', and then press 'Enter' before reaching the next breakpoint, the next breakpoint is skipped. (Issue: https://github.com/ruby/debug/issues/1098) reproduce script: ```ruby require 'debug' def test_issue_key_strokes puts 'Please press "C" once and continue' debugger # Stop here. puts 'then press "Retern" once within 5 seconds.' sleep 5 puts 'folloing break point will be skipped' debugger # Skipped! It should stop here. end puts 'Start' test_issue_key_strokes puts 'End' ``` --- lib/debug/session.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/debug/session.rb b/lib/debug/session.rb index 05dc7f508..ffc2f897e 100644 --- a/lib/debug/session.rb +++ b/lib/debug/session.rb @@ -442,7 +442,10 @@ def wait_command end else @ui.puts "INTERNAL_INFO: #{JSON.generate(@internal_info)}" if ENV['RUBY_DEBUG_TEST_UI'] == 'terminal' - line = @ui.readline prompt + t = Time.now + while line = @ui.readline(prompt) + break if line != '' || Time.now - t > 0.1 + end end case line