Skip to content

Commit d847e20

Browse files
committed
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.
1 parent fcb455f commit d847e20

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

lib/debug/client.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ def send msg
173173
end
174174

175175
def connect
176+
pre_commands = (CONFIG[:commands] || '').split(';;')
177+
176178
trap(:SIGINT){
177179
send "pause"
178180
}
@@ -199,7 +201,12 @@ def connect
199201
prev_trap = trap(:SIGINT, 'DEFAULT')
200202

201203
begin
202-
line = readline
204+
if pre_commands.empty?
205+
line = readline
206+
else
207+
line = pre_commands.shift
208+
puts "(rdbg:remote:command) #{line}"
209+
end
203210
rescue Interrupt
204211
retry
205212
ensure

0 commit comments

Comments
 (0)