ruby / vscode-rdbg

VSCode Ruby rdbg Debugger
MIT License
176 stars 50 forks source link

VS Code does not correctly attach to UNIX domain socket #473

Open Neighborkid01 opened 3 months ago

Neighborkid01 commented 3 months ago

I am running my rails server with the command rdbg -n -c --open=vscode -- rails s and it will open VS Code but running the attach configuration will result in the error "Can not find attachable Ruby process." and if I run rdbg --util=list-socks I see nothing even though in the server output it specifies a port to listen on.

$ rdbg -n -c --open=vscode -- rails s
DEBUGGER: Debugger can attach via UNIX domain socket (/var/folders/k4/lsrtl0y55718pst90df0ldzh0000gn/T/com.apple.shortcuts.mac-helper/rdbg-501/rdbg-72212)
Launching: code /Users/executor/Documents/GitHub/VideoConnect/
=> Booting Puma
=> Rails 7.0.7.2 application starting in development
...

If I run rdbg -n -c -O -- rails s, then I see two log lines from the server specifying the UDS port and running rdbg --util=list-socks returns the port as expected. If I open VS Code and try to attach to the debugger again with the default config, I get the same error, but if I manually specify the debugPort to be the one from the console output, it is able to connect correctly and everything works as expected.

$ rdbg -n -c -O -- rails s
DEBUGGER: Debugger can attach via UNIX domain socket (/var/folders/k4/lsrtl0y55718pst90df0ldzh0000gn/T/com.apple.shortcuts.mac-helper/rdbg-501/rdbg-72755)
DEBUGGER: Debugger can attach via UNIX domain socket (/var/folders/k4/lsrtl0y55718pst90df0ldzh0000gn/T/com.apple.shortcuts.mac-helper/rdbg-501/rdbg-72755)
=> Booting Puma
=> Rails 7.0.7.2 application starting in development 
...
{
    "type": "rdbg",
    "name": "Attach with rdbg",
    "request": "attach",
    "debugPort": "/var/folders/k4/lsrtl0y55718pst90df0ldzh0000gn/T/com.apple.shortcuts.mac-helper/rdbg-501/rdbg-71078",
}
pspacekpcty commented 1 month ago

I can confirm the same issue existing in my case. Is there any plan for fixing this please? It is annoying to change the debug port with each rails app start to be able to attach debugger. Thank you.