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
Ruby 3.1 added the bundled debugger that is activated either by the command rdbg or by adding a breakpoint with binding.break. But in any case the prompt displays the triangle character in the comint buffer and hangs. To support it, there is a need to set the environment variable RUBY_DEBUG_NO_RELINE. For example, the following code works ok:
BTW, in some places inf-ruby.el modifies the environment without making its copy with (copy-sequence process-environment), so the environment is changed globally in those place (don't know if this is intentional).
Also for more support of rdbg, all places that mention another debugger rdb, could also add rdbg.
BTW, in some places inf-ruby.el modifies the environment without making its copy with (copy-sequence process-environment), so the environment is changed globally in those place (don't know if this is intentional).
Good catch. We do call setenv in one place (as opposed to changing process-environment immutably in another), and that one should use copy-sequence.
We can add the new setenv call to run-ruby-new as well.
Will that be enough? E.g. the case with binding.break will probably usually happen in the middle of an RSpec run. Those are lanuched by code not controlled by inf-ruby. Though I suppose we can also add something like the above to rspec-mode.
But if not running RSpec, what is the main scenario .rdbgrc does fix? Putting a breakpoint somewhere inside the code and then running rails server to trigger it?
But if not running RSpec, what is the main scenario .rdbgrc does fix? Putting a breakpoint somewhere inside the code and then running rails server to trigger it?
Right, the main scenario is a breakpoint with running rails server.
But config set no_reline true in .rdbgrc still has no effect,
maybe because it's too late at this point to disable reline
when the debugger was already started.
But env.variable still helps in any case.
Env variable when running RSpec?
Env variable helps in all cases: in RSpec, in rails server, etc.
Activity
dgutov commentedon Jan 19, 2022
Good catch. We do call
setenvin one place (as opposed to changingprocess-environmentimmutably in another), and that one should usecopy-sequence.We can add the new
setenvcall torun-ruby-newas well.Will that be enough? E.g. the case with
binding.breakwill probably usually happen in the middle of an RSpec run. Those are lanuched by code not controlled byinf-ruby. Though I suppose we can also add something like the above torspec-mode.link0ff commentedon Jan 19, 2022
An alternative to setting env.variable
RUBY_DEBUG_NO_RELINEis to add such line to~/.rdbgrc:Maybe this could be mentioned in README. But after trying to add this line and running RSpec, it prints to stdout:
but still shows the triangle and hangs, I don't know why. But env.variable still helps in any case.
dgutov commentedon Jan 21, 2022
That's unfortunate.
But if not running RSpec, what is the main scenario
.rdbgrcdoes fix? Putting a breakpoint somewhere inside the code and then runningrails serverto trigger it?Env variable when running RSpec?
link0ff commentedon Jan 31, 2022
Right, the main scenario is a breakpoint with running
rails server.But
config set no_reline truein.rdbgrcstill has no effect,maybe because it's too late at this point to disable
relinewhen the debugger was already started.
Env variable helps in all cases: in RSpec, in
rails server, etc.dgutov commentedon Feb 3, 2022
Please check that it works for you now.
And I'll try to put a similar fix in
rspec-mode.Set RUBY_DEBUG_NO_RELINE
link0ff commentedon Feb 8, 2022
Thanks for the fix. I confirm it's working nicely now.