You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Do not kill the Ruby process when IDE debugger session disconnects #199
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!
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]
Activity
lalunamel commentedon Sep 16, 2020
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
quitcommand, 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#L2Commands are sent over a socket from the IDE to
ruby-debug-ideand parsed here. https://github.com/ruby-debug/ruby-debug-ide/blob/master/lib/ruby-debug-ide/ide_processor.rb#L75I'd imagine any solution to prevent
ruby-debug-idefrom terminating would involve mucking around incontrol.rbhurricup commentedon Sep 17, 2020
@TSMMark what version of the gem used?
TSMMark commentedon Sep 17, 2020
@hurricup latest.
ruby-debug-ide (0.7.2)TSMMark commentedon Sep 25, 2020
In my quick local testing, it looks like simply removing the
exit!line here works like a charm!ruby-debug-ide/lib/ruby-debug-ide/commands/control.rb
Line 14 in 83b5d22
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 somethingyasaichi commentedon Sep 10, 2022
For the future googlers, here's my patch until the PR is merged:
Usage:
Don't terminate web container when disconnecting debugger