Skip to content
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

Continue execution with pry-remote #7

Open
gavinhughes opened this issue Nov 22, 2011 · 7 comments
Open

Continue execution with pry-remote #7

gavinhughes opened this issue Nov 22, 2011 · 7 comments

Comments

@gavinhughes
Copy link

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?

@Mon-Ouie
Copy link
Owner

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

@cj
Copy link

cj commented Feb 24, 2012

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....

@Mon-Ouie
Copy link
Owner

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).

@cluesque
Copy link

cluesque commented Nov 3, 2012

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?

@johnadamson
Copy link

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.

@Mon-Ouie
Copy link
Owner

Mon-Ouie commented Feb 3, 2013

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.

@johnadamson
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants