How do I return early from a rake task?

后端 未结 7 1473
一向
一向 2020-12-07 11:13

I have a rake task where I do some checks at the beginning, if one of the checks fails I would like to return early from the rake task, I don\'t want to execute any of the r

7条回答
  •  爱一瞬间的悲伤
    2020-12-07 11:28

    If you meant exiting from a rake task without causing the "rake aborted!" message to be printed, then you can use either "abort" or "exit". But "abort", when used in a rescue block, terminates the task as well as prints the whole error (even without using --trace). So "exit" is what I use.

提交回复
热议问题