I have a Rakefile that I use to automate some tasks in my project.
Inside some tasks, I call system
, but, even if the process return an error,
task continues without any issue.
How can I avoid that? I want to make rake exit when some subprocess return an error.
Thanks in advance
You can evaluate the return value of system
system('inexistent command') or exit!(1)
puts "This line is not reached"
sh
is the Rake way to call a command. It will fail with a neat message. Compared with system
, sh
prints out the command as well.
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