Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Improve --keep-process-alive
  • Loading branch information
vagoston committed Jul 10, 2022
commit dc35b3bac274ca3894a8bb12ad7e15839b95dc36
10 changes: 8 additions & 2 deletions lib/ruby-debug-ide/commands/control.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@ def regexp

def execute
begin
@printer.print_msg("finished")
@printer.print_debug("Exiting debugger.")
if ENV['DEBUGGER_KEEP_PROCESS_ALIVE'] == "true"
@delegate_sd_obj.interface.closing = true
Debugger.breakpoints.clear
@delegate_sd_obj.interface.command_queue << 'c'
else
@printer.print_msg("finished")
@printer.print_debug("Exiting debugger.")
end
ensure
exit! unless ENV['DEBUGGER_KEEP_PROCESS_ALIVE'] == "true" # exit -> exit!: No graceful way to stop threads...
end
Expand Down
4 changes: 3 additions & 1 deletion lib/ruby-debug-ide/interface.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ class LocalInterface < Interface

class RemoteInterface < Interface # :nodoc:
attr_accessor :command_queue
attr_accessor :closing

def initialize(socket)
@socket = socket
@command_queue = Queue.new
@closing = false
end

def read_command
Expand All @@ -23,7 +25,7 @@ def read_command
end

def print(*args)
@socket.printf(*args)
@socket.printf(*args) unless (@closing && ENV['DEBUGGER_KEEP_PROCESS_ALIVE'])
end

def close
Expand Down
2 changes: 1 addition & 1 deletion test-base/test_base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def start_ruby_process(script, additional_opts = '')
status = wait_thr.value
end
@process_finished = true
fail "ERROR: \"#{process}\" failed with exitstatus=#{status.exitstatus}" unless status.success?
fail "ERROR: \"#{cmd}\" failed with exitstatus=#{status.exitstatus}" unless status.success?
end

end
Expand Down