pry-remote icon indicating copy to clipboard operation
pry-remote copied to clipboard

Continue execution with pry-remote

Open gavinhughes opened this issue 13 years ago • 7 comments

In Rails (3.1.1) running on Pow, when I pause execution with binding.remote_pry and then remote in with pry-remote, execution does not continue after I exit the pry session. If I pry-remote back in, I'm at the same place. How to continue program execution in this scenario?

gavinhughes avatar Nov 22 '11 13:11 gavinhughes

Could you provide an example script to reproduce? I don't have this issue with this (trivial) sample script:

require 'pry-remote'

class Foo
  def initialize(x, y)
    binding.remote_pry "0.0.0.0"
    puts 3
  end
end

Foo.new 10, 20

Mon-Ouie avatar Nov 24 '11 21:11 Mon-Ouie

Doing exit works for me. What doesn't work is doing cd .. to continue to the next, which works with normal binding.pry and saves you having to exit and come back in....

cj avatar Feb 24 '12 22:02 cj

Right, I see what you mean. It "just works" in Pry because it runs in the same process. In this case, you don't know whether or not the process is still running after each step. I guess one way to implement that would be having the pry'd program send some message to the client upon exit (e.g. using an at_exit hook).

Mon-Ouie avatar Feb 25 '12 07:02 Mon-Ouie

My concern is in the other direction. I've got two processes: pry-remote in a console, and my rails app under pow. I put a "binding.remote_pry" in the rails app, and start a request with a browser. I run "pry-remote" in the console and do get connected to that running program, where I can examine variables and such. But then I don't see how to continue execution. If I ^D or 'exit' the rails app raises an exception so I can't continue after. 'cd ..' doesn't seem to do anything, I wind up where I started every time.

Is there a way to continue execution of the pry'd process?

cluesque avatar Nov 03 '12 17:11 cluesque

I haven't been able to find a way to gracefully disconnect the pry-remote client from the server without an exception being raised. My workaround is to set the breakpoints as follows:

require 'pry-remote'; binding.remote_pry rescue DRb::DRbConnError

When I quit pry, the application continues running without the exception unwinding the stack.

johnadamson avatar Jan 07 '13 06:01 johnadamson

As mentionned before, leaving the above script with both exit and ^D resumes the execution of the program.

johanadamson: Btw, binding.remote_pry rescue DRb::DRbConnError does not rescue DRb::DRbConnErrors, it rescues StandarExceptions, in which case it evaluates to DRb::DRbConvError.

Mon-Ouie avatar Feb 03 '13 09:02 Mon-Ouie

mon-ouie: Yes, you are right, my mistake. rescue as a statement modifier will rescue all errors descended from StandardError.

johnadamson avatar Feb 04 '13 17:02 johnadamson