Ruby: interrupt a running script

Need to stop a running script in mid-stride and check/change variables?

Here’s how:

1. add Pry

require ‘pry’

2. add an Exception handler

rescue Exception => exception



Now just use Ctrl C (on a Mac, Unix and Linux) and you’ll exit out with a debugger command prompt.

And exit pry permanently with:



Leave a Reply

Your email address will not be published. Required fields are marked *