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

quit command immediately #819

Merged
merged 1 commit into from
Nov 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/debug/local.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def width
end

def quit n
yield
exit n
end

Expand Down
2 changes: 1 addition & 1 deletion lib/debug/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ def pause
Process.kill(TRAP_SIGNAL, Process.pid)
end

def quit n
def quit n, &_b
# ignore n
sock do |s|
s.puts "quit"
Expand Down
10 changes: 7 additions & 3 deletions lib/debug/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,9 @@ def register_default_command
# * Finish debugger (with the debuggee process on non-remote debugging).
register_command 'q', 'quit' do |arg|
if ask 'Really quit?'
@ui.quit arg.to_i
@ui.quit arg.to_i do
request_tc :quit
end
leave_subsession :continue
else
next :retry
Expand All @@ -501,8 +503,10 @@ def register_default_command
# * `q[uit]!`
# * Same as q[uit] but without the confirmation prompt.
register_command 'q!', 'quit!', unsafe: false do |arg|
@ui.quit arg.to_i
leave_subsession nil
@ui.quit arg.to_i do
request_tc :quit
end
leave_subsession :continue
end

# * `kill`
Expand Down
3 changes: 3 additions & 0 deletions lib/debug/thread_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,7 @@ def wait_next_action_
set_mode :waiting if !waiting?
cmds = @q_cmd.pop
# pp [self, cmds: cmds]

break unless cmds
ensure
set_mode :running
Expand Down Expand Up @@ -1161,6 +1162,8 @@ def wait_next_action_
end
event! :result, nil

when :quit
sleep # wait for SystemExit
when :dap
process_dap args
when :cdp
Expand Down