-
Notifications
You must be signed in to change notification settings - Fork 83
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
Launching rspec process via spring does not attach debugging as expected #152
Comments
Note that this behavior (not using spring while debugging) is also matched by RubyMine here (see "Special Notes" section). |
@CJBridges all forks are debuggable, as you can see here
|
@CJBridges What ruby/gems versions do you use? |
@ViugiNick - I've been using:
On a personal note, I've mostly moved away from using VSCode on a day to day, so I'm not going to be spending much additional time to help out with further debugging unfortunately beyond my repro above. |
@ViugiNick I've hit this issue after trying to debug my tests in my rails app. I confirm that running with I can setup a demo repo is needed |
@bartocc What command do you run to debug tests? |
Running my tests with Running my tests with |
I hit a related issue that I can't seem to solve. I understand it might be related: the debugger might attach to the Puma process instead of the thread where the actual controller code is run. Does it make sense? Is there a way to force proper behaviour? I don't know if it's an issue in the VSCode extension or ruby-debug-ide. |
I have the same problem. |
Sorry to comment on an old issue, but I really want to find a solution for this. I'm using an awesome VS Code extension called Test Explorer, with the Ruby test adapter. This makes VS Code feel like a proper IDE since it shows all my RSpec tests inside VS Code, and it has buttons and keyboard shortcuts I can use to start running or debugging tests. So it would be awesome if I could get Spring working! This makes my tests so much faster, and I have to keep using the terminal until I can figure this out. I don't have the time to keep digging into this, so I would be interested in sponsoring this issue using a third-party bounty service, maybe https://gitpay.me |
spring
, at an overly simplistic level, allows for early preloading of code, with the largest leverage tending to be gems. It functions by starting a process (spring server
), then each time you want to run a command, it forks and the child process runs your main action (e.g.rspec
).rdebug-ide -- bin/rspec spec/file_spec.rb
debugs the spring process, but does not debug the actual thing we want (the rspec child process launched underneath).Steps to reproduce:
Case 1 (not working):
rdebug-ide --host 127.0.0.1 --port 2345 -- bin/rspec spec/file_spec.rb
nc 127.0.0.1 2345
then...Expected: Break at line 5
Current: does not break at all
Case 2 (works, but slow):
DISABLE_SPRING=1 rdebug-ide --host 127.0.0.1 --port 2345 -- bin/rspec spec/file_spec.rb
(other steps same as above)
This breaks at line 5 as expected, but as spring is not used, we incur the whole cost of launching the app. This is > 10 seconds longer on an app I'm using it on.
In GDB, this is supported as
set follow-fork-mode child
- http://visualgdb.com/gdbreference/commands/set_follow-fork-mode.Please let me know of any suggested fixes or workarounds, and I might be able to tackle it.
Other info: Note that my intended use case at the end of the day is to start an rspec process under debugger from vscode, with the launch speed benefits of spring, so vscode specific workarounds are fine too. I'm also familiar with other methods of debugging (e.g.
binding.pry
andbyebug
), but really trying to get first class IDE debugging support working.The text was updated successfully, but these errors were encountered: