From 07dc0fa7d9e8744de0b1d45498eff71690a56ef8 Mon Sep 17 00:00:00 2001 From: Koichi Sasada Date: Mon, 11 Jul 2022 01:16:47 +0900 Subject: [PATCH] `ignore_bp` Ignore breakpoints if no clients are attached. --- lib/debug/config.rb | 1 + lib/debug/server.rb | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/debug/config.rb b/lib/debug/config.rb index 2366ab3d2..b1a455f48 100644 --- a/lib/debug/config.rb +++ b/lib/debug/config.rb @@ -44,6 +44,7 @@ module DEBUGGER__ sock_path: ['RUBY_DEBUG_SOCK_PATH', "REMOTE: UNIX Domain Socket remote debugging: socket path"], sock_dir: ['RUBY_DEBUG_SOCK_DIR', "REMOTE: UNIX Domain Socket remote debugging: socket directory"], local_fs_map: ['RUBY_DEBUG_LOCAL_FS_MAP', "REMOTE: Specify local fs map", :path_map], + ignore_bp: ['RUBY_DEBUG_IGNORE_BP', "REMOTE: Ignore breakpoints if no clients are attached", :bool, 'false'], cookie: ['RUBY_DEBUG_COOKIE', "REMOTE: Cookie for negotiation"], open_frontend: ['RUBY_DEBUG_OPEN_FRONTEND',"REMOTE: frontend used by open command (vscode, chrome, default: rdbg)."], chrome_path: ['RUBY_DEBUG_CHROME_PATH', "REMOTE: Platform dependent path of Chrome (For more information, See [here](https://github.com/ruby/debug/pull/334/files#diff-5fc3d0a901379a95bc111b86cf0090b03f857edfd0b99a0c1537e26735698453R55-R64))"], diff --git a/lib/debug/server.rb b/lib/debug/server.rb index 4f15707b3..f56f2dddf 100644 --- a/lib/debug/server.rb +++ b/lib/debug/server.rb @@ -334,7 +334,9 @@ def puts str = nil end def readline prompt - input = (sock do |s| + input = (sock(skip: CONFIG[:ignore_bp]) do |s| + next unless s + if @repl raise "not in subsession, but received: #{line.inspect}" unless @session.in_subsession? line = "input #{Process.pid}"