From 54f17a7c6d06b1258179f8fdd15025bbb3ad3cdd Mon Sep 17 00:00:00 2001 From: Koichi Sasada Date: Fri, 8 Jul 2022 19:40:26 +0900 Subject: [PATCH] support `-e` option for client Support `-e` option on the attach client with `rdbg -A`. `rdbg -A -e 'p 1'` will execute `p 1` at first and user can input debug commands on REPL. --- lib/debug/client.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/debug/client.rb b/lib/debug/client.rb index ee32b238b..056dd5cd0 100644 --- a/lib/debug/client.rb +++ b/lib/debug/client.rb @@ -173,6 +173,8 @@ def send msg end def connect + pre_commands = (CONFIG[:commands] || '').split(';;') + trap(:SIGINT){ send "pause" } @@ -199,7 +201,12 @@ def connect prev_trap = trap(:SIGINT, 'DEFAULT') begin - line = readline + if pre_commands.empty? + line = readline + else + line = pre_commands.shift + puts "(rdbg:remote:command) #{line}" + end rescue Interrupt retry ensure