2

Pry goes into interactive mode if it encounters an exception (eg if you just put an undefined variable 'x' at the end of the script).

(Also if, inside the script itself you require 'pry' and put binding.pry at the point you want to go interactive at.)

But I'm wondering: Is there's some kind of flag/option/argument thingy that I can add to the pry example.rb command when I enter it at the command prompt, so it will go interactive when it reaches the end of executing any example.rb script, regardless of what's inside? (Assuming no exceptions before the end, of course.)

(This would obviously be especially useful for use with editors that you can run external programs from like Notepad++, see this and this.)

Community
  • 1
  • 1
Owen_AR
  • 2,867
  • 5
  • 20
  • 23

1 Answers1

3

Not yet, but file an issue and i'll add it :)

horseyguy
  • 29,455
  • 20
  • 103
  • 145
  • Okay, sure. Should I copy [this pry problem](http://stackoverflow.com/questions/16211133/ruby-get-pry-to-display-characters-like-aoussaouss-utf-8-encoding-correctly) over to github too? :) (Did you already see it?) – Owen_AR Apr 25 '13 at 12:03
  • There, posted [an issue for `pry -i example.rb` on github](https://github.com/pry/pry/issues/911). Looks like a volunteer helper showed up in the first two minutes. ^^ – Owen_AR Apr 25 '13 at 12:18
  • Aaaaaand patch is merged. :) – richo Apr 25 '13 at 12:54
  • @richo How does it work? I just `gem update pry`'d, but I can't seem to get any sort of `-i` flag to work... – Owen_AR Apr 25 '13 at 14:23
  • It's on master, so not released, you would need to `git clone git://github.com/pry/pry.git; cd pry; gem build pry.gemspec; gem install pry-*.gem` – richo Apr 25 '13 at 14:43