Search

Debugging Remote Processes With Pry-Remote

Aubrey Rhodes

1 min read

May 8, 2012

Debugging Remote Processes With Pry-Remote

Highgroove really likes Pry. It’s a great tool for digging into your code and seeing what’s going on with tons of great features. However, there are situations where using a standard binding.pry breakpoint will not block your program and allow you to inspect it. I recently ran into this situation when trying to debug an application that used Foreman to manage it’s processes. Luckily, the pry-remote project turned out to be a great solution.

When a process being run by Foreman hits a regular Pry breakpoint, the process will halt, but you will never be able to interact with the Pry session. This effectively freezes the app, forcing you to kill the Foreman process.

To work around this using pry-remote, you must first set it up in your project. First install the gem:

Once the gem is installed, you can now add a breakpoint in your application with binding.remote_pry. When the breakpoint is hit, pry-remote will block your app and open up a DRb endpoint that a client can connect to. Running pry-remote in a shell will then connect to the session and you’ll be able to interact with Pry as you normally would. Simply call exit in the Pry session to unblock the application.

Have you picked up any other tips or tricks while using Pry? Leave a comment below!

Steve Sparks

Reviewer Big Nerd Ranch

Steve Sparks has been a Nerd since 2011 and an electronics geek since age five. His primary focus is on iOS, watchOS, and tvOS development. He plays guitar and makes strange and terrifying contraptions. He lives in Atlanta with his family.

Speak with a Nerd

Schedule a call today! Our team of Nerds are ready to help

Let's Talk

Related Posts

We are ready to discuss your needs.

Not applicable? Click here to schedule a call.

Stay in Touch WITH Big Nerd Ranch News