Last active
January 10, 2020 21:40
-
-
Save flomotlik/4136579 to your computer and use it in GitHub Desktop.
Heroku run script that exits with the correct error code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
array=( $@ ) | |
len=${#array[@]} | |
app=${array[$len-1]} | |
args=${array[@]:0:$len-1} | |
buffer_file=/tmp/last_heroku_run_`date +%N` | |
/usr/bin/heroku run "$args; echo \$?" --app $app 2>&1 | tee $buffer_file | |
exit `tail -1 $buffer_file` | |
#Run with heroku_run 'bundle exec rake db:migrate' MY_HEROKU_APP_NAME |
Does anyone have an example of how to use this in a Travis CI script?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks! Very helpful!