I do some usual tasks with Rakefile
, such as compilation, linking, etc.
When compilation fails ruby shows full backtrace in which task error happen, but it's really useless for me, even more: this backtrace hides compilation errors.
$ rake
mkdir -p build
llvm-as source/repl.ll -o build/repl.bc
llvm-as: source/repl.ll:6:22: error: expected value token
call i32 @fputc(i8 'x', i32 0)
^
rake aborted!
Command failed with status (1): [llvm-as source/repl.ll -o build/repl.bc...]
/usr/local/lib/ruby/1.9.1/rake.rb:993:in `block in sh'
/usr/local/lib/ruby/1.9.1/rake.rb:1008:in `call'
/usr/local/lib/ruby/1.9.1/rake.rb:1008:in `sh'
/usr/local/lib/ruby/1.9.1/rake.rb:1092:in `sh'
...
How to hide all after "rake aborted!" ?
It seems that you are using the "sh" command in the rake task to start the compiler. In that case you should catch a RuntimeError, in order to get this error. Something like this:
task "foo" do
begin
sh "bar"
rescue RuntimeError => e
puts e.message
exit(1)
end
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With