2

Context: I recently switched from Sublime Text to Visual Studio Code to test the debugging functionalities of the Microsoft text editor. The main problem here is that my Ruby on Rails environment is set on bash in Ubuntu on Windows.

I changed the integrated terminal shell to bash, so, I can use the integrated terminal to launch/debug my application. But when using the integrated debug tool using the Ruby extension ( https://github.com/rubyide/vscode-ruby ), it seems to launch the windows cmd to execute the configuration:

Debugger terminal error: Process failed: spawn rdebug-ide.bat ENOENT

Question: Is my problem caused by vscode trying to use the windows cmd instead of the specified bash shell? If so, is there a way to tell vscode to use it instead of the windows cmd?

Here's my launch.json config for the task I want to execute :

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Rails server",
      "type": "Ruby",
      "request": "launch",
      "cwd": "/mnt/c/Repos/<project_name>",
      "program": "rails",
      "pathToRDebugIDE": 
"~/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/ruby-debug-ide-0.6.0/bin/rdebug-ide",
      "args": ["server"]
    }
}
Samvel Aleqsanyan
  • 2,812
  • 4
  • 20
  • 28
HEYIMFUZZ
  • 85
  • 1
  • 6
  • I don't think running VSCode on WSL works yet unless you're using a recent (as of this posting) Windows Insider build. https://github.com/Microsoft/WSL/issues/2760 There looks to be some (very) recent work on it from the VSCode side: https://github.com/rubyide/vscode-ruby/issues/336 – hobbsenigma May 01 '18 at 18:05

1 Answers1

0

That Ruby extension of Visual Studio Code is only able to use cmd to launch the debugger. Therefore you need a .cmd wrapper to call rdebug-ide.

Installing the RubyDevKit for Windows should provide the necessary wrappers, but you can also use the lines below. It basically looks like this:

@ECHO OFF
IF NOT "%~f0" == "~f0" GOTO :WinNT
ECHO.This version of Ruby has not been built with support for Windows 95/98/Me.
GOTO :EOF
:WinNT
@ruby.exe "%~dpn0" %*

(This will use the ruby.exe in your PATH to execute the script named like the .bat file, but without the extension.)

Put this in the same location as rdebug-ide and call it rdebug-ide.bat. Adjust your launch.json so that pathToRDebugIDE points to this .bat file (use the full Windows path), and make sure ruby is in your PATH.

I'm currently using this setup with a cygwin installation of ruby, rdebug-ide, rails etc.

su_li
  • 199
  • 9