Run "Remote External Tool" to set up remote debug session

I can get remote debugging working in RM 7 if I run this command from my vagrant machine first:
rdebug-ide --host 0.0.0.0 --port 5858 --dispatcher-port 26162 -- bin/rails s

So far, so good.

However, I'd like for RubyMine to run this for me (and my fellow devs) automatically every time I initiate a debug session.
No problem! I'll just create a new remote tool that my debug configuration launches before it runs.
So, here's what I've got:

(Note that if I don't launch it with `which rdebug-ide`, it doesn't know where to find rdebug-ide, and I get a separate error)
Program: `which rdebug-ide`
Parameters: --host 0.0.0.0 --port 5858 --dispatcher-port 26162 -- bin/rails s
Working Directory: /vagrant_host/ynab_api

If I run that, I see the rdebug-ide initial output:
ssh://vagrant@127.0.0.1:2522null --host localhost --port 5858 --dispatcher-port 26162 -- bin/rails s
Fast Debugger (ruby-debug-ide 0.4.22, debase 0.1.0) listens on localhost:5858


...but it never initiates debugging, presumably because the external command hasn't finished yet.

No problem! I'll run rdebug-ide in the background so that it exits, so I add an `&` to my parameters:
Parameters: --host 0.0.0.0 --port 5858 --dispatcher-port 26162 -- bin/rails s

But now I just get this in my console, and the rails server doesn't actually appear to start. I don't hit any breakpoints, and I can't see my server running on vagrant:

ssh://vagrant@127.0.0.1:2522null --host localhost --port 5858 --dispatcher-port 26162 -- bin/rails s &


Process finished with exit code 0

So then I thought, I'll rub rdebug-ide manually on the host (which I know works), but tell the remote debug configuration to run an external tool that just does an "echo" command, and I get the same result. It just tells me `Process finished with exit code 0` and the debug session never starts. So, I think something is broken with the ability to run an external command prior to debugging. Could that be? I hope I'm just missing something.

5 comments
Comment actions Permalink

Lastly, the reason I'm doing this is that I can't get my remote ruby SDK to work if I do a "normal" Rails debug session with my remote Ruby SDK selected. In that case, it looks like it's trying to run rails on my host machine, rather than the remote machine. I get output like this:

/home/vagrant/.rvm/rubies/ruby-2.1.0/bin/ruby -e 'at_exit{sleep(1)};$stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)' /home/vagrant/.rvm/gems/ruby-2.1.0/gems/ruby-debug-ide-0.4.22/bin/rdebug-ide --disable-int-handler --port 44936 --dispatcher-port 38680 -- /Users/taylorbrown/projects/our_project/bin/rails server -b 0.0.0.0 -p 3000 -e development
zsh:cd:1: no such file or directory: /Users/taylorbrown/projects/our_project
Fast Debugger (ruby-debug-ide 0.4.22, debase 0.1.0) listens on 127.0.0.1:44936
Uncaught exception: cannot load such file -- /Users/taylorbrown/projects/our_project/bin/rails



Is that expected? This used to work in RM 6
0
Comment actions Permalink

Well, I fixed my previous error by adding a mapping in the debug configuration from my local project directory to the vagrant remote directory. After that, debugging with a remote SDK seems to work again.
I'm still curious why I can't run a remote program before I initia debugging, but that is of lesser importance now.

0
Comment actions Permalink

The debugger waits for IDE to connect to it.

Hope this answers your question.

Regards, Oleg.

0
Comment actions Permalink

I have similar problem with remote Node.js debugging. 

I mean - it works great, but I'd like to make a remote command before running the debug. So, I added 'Remote External Tool' before launch. However, when I click Run or Debug, the process stops after running that remote command. On the console I see this message:

'Process finished with exit code 0'.

And nothing else happens. Without this remote command everything works. It also works if I add LOCAL 'External Tool' - ex. some windows batch file. I think this is a bug.

0
Comment actions Permalink

@Jacob,

that's a known problem, please vote and follow it:

https://youtrack.jetbrains.com/issue/IDEA-144799 

0

Please sign in to leave a comment.