Open TSMMark opened 3 years ago
I'd like this feature as well.
I'm not a maintainer or anything, but I've been noodling around the code recently and can point you in the right direction.
Here's the bit of code that handles the quit
command, which is sent when your IDE disconnects from a debugging session. https://github.com/ruby-debug/ruby-debug-ide/blob/master/lib/ruby-debug-ide/commands/control.rb#L2
Commands are sent over a socket from the IDE to ruby-debug-ide
and parsed here. https://github.com/ruby-debug/ruby-debug-ide/blob/master/lib/ruby-debug-ide/ide_processor.rb#L75
I'd imagine any solution to prevent ruby-debug-ide
from terminating would involve mucking around in control.rb
@TSMMark what version of the gem used?
@hurricup latest. ruby-debug-ide (0.7.2)
In my quick local testing, it looks like simply removing the exit!
line here works like a charm!
The same Ruby process can later be reattached to the debugger and everything.
I'll try to submit a PR asap that optionally skips the exit!
based on cli flag or env var or something
For the future googlers, here's my patch until the PR is merged:
$ cat bin/rdebug-ide
#!/usr/bin/env ruby
require "rubygems"
require "bundler/setup"
require "ruby-debug-ide"
Debugger::QuitCommand.prepend(
Module.new {
def execute
# NOTE: We must ensure that all breakpoints are cleared before disconnecting sessions,
# or you'll face a `closed stream` error.
Debugger.breakpoints.clear
@printer.print_msg("finished")
end
}
)
load Gem.bin_path("ruby-debug-ide", "rdebug-ide")
Usage:
$ bin/rdebug-ide [same arguments as the original ones]
When my IDE disconnects from the debug session, it kills the main process – the process started by
rdebug-ide
command. How to avoid this?If this is not supported already, I would be happy to try to implement a CLI flag for this if given a pointer or two in the right direction.
I scoured this repo for a way to do this or an open issue but couldn't find anything.
--disable-int-handler
sounded like it might do it, but has no effect. Sorry if this is a duplicate issue!