When starting a team through a hero, for example:
heroku run rake db:migrate
I would like to know if the team succeeded or not. Unfortunately, even if the migration fails, I get exit status 0.
I am writing a ruby โโcode that wraps this command and calls it, and causes an error if the command fails. The code looks like this:
Open3.popen2e('heroku run rake db:migrate') do |stdin, stdout_and_stderr, wait_thr| raise 'running migration failed' unless wait_thr.value.success? end
Even with this failure, I get a message:
rake is interrupted! StandardError: an error occurred, this and all later migrations are canceled:
My code alone does not cause an error. By checking wait_thr.value in the code above, it has an exit code of 0, which means that the heroโs CLI believes that the rake call succeeded.
How can my code know if the team launched by the cli heroic worked? Is there any way to tell the CLI hero to return the status code of the team in which he was running?
heroku heroku-toolbelt
Oved d
source share