I use rake
and its Rakefile
to automate the build and documentation generation. A handy tool, but there is one problem.
If the called command (via sh
) returns the status not zero, then this is considered as an error, and an exception is thrown, and the execution of the task
stops. This behavior suits me, but because of the throwing of an exception, a long ruby-backtrace is shown, which does not interest me at all, only hides compiler errors from me.
I was looking for how to disable this backtrace, found such a solution:
sh "some command" do |t, ok| puts "error" if not ok end
Works, execution stops, backtrace is not displayed. But if it is used as a dependency in another task
, then it does not work: the execution of a task
with an error stops, and it is considered to be executed correctly, which is incorrect behavior.
How to make rake
not output backtrace?