Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use pry-rescue In a rake Task?

Tags:

ruby

pry

I'm trying to use pry-rescue inside of a rake task. Something like this:

   bundle exec rescue rake my:task

But when an exception occurs (undefined method...) it just exists like normal. How can I use pry-rescue with my rake task?

like image 226
Gil Birman Avatar asked Jun 12 '14 22:06

Gil Birman


1 Answers

Did you try wrapping your task body in a rescue block?

task 'my_task' do
  Pry.rescue {
    things.that_need_doing
  }
end
like image 100
prater Avatar answered Oct 17 '22 01:10

prater