Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Travis: before_script exit 1 in case of errors
  • Loading branch information
dregad committed Oct 21, 2013
1 parent 63e33b2 commit 8a0fb52
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions scripts/travis_before_script.sh
Expand Up @@ -34,7 +34,7 @@ case $DB in
DB_CMD='mysql -e'
DB_CMD_SCHEMA="$MANTIS_DB_NAME"

$DB_CMD "$SQL_CREATE_DB"
$DB_CMD "$SQL_CREATE_DB" || exit 1
;;

pgsql)
Expand All @@ -43,8 +43,8 @@ case $DB in
DB_CMD="psql -U $DB_USER -c"
DB_CMD_SCHEMA="-d $MANTIS_DB_NAME"

$DB_CMD "$SQL_CREATE_DB"
$DB_CMD "ALTER USER $DB_USER SET bytea_output = 'escape';"
$DB_CMD "$SQL_CREATE_DB" || exit 1
$DB_CMD "ALTER USER $DB_USER SET bytea_output = 'escape';" || exit 1
;;
esac

Expand Down Expand Up @@ -114,14 +114,14 @@ do
done

# trigger installation
curl --data "${query_string:1}" http://$HOSTNAME/admin/install.php
curl --data "${query_string:1}" http://$HOSTNAME/admin/install.php || exit 1


# -----------------------------------------------------------------------------
step "Post-installation steps"

echo "Creating project"
$DB_CMD "$SQL_CREATE_PROJECT" $DB_CMD_SCHEMA
$DB_CMD "$SQL_CREATE_PROJECT" $DB_CMD_SCHEMA || exit 1


# enable SOAP tests
Expand Down

3 comments on commit 8a0fb52

@rombert
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be simpler to use #!/bin/bash -e ?

@dregad
Copy link
Member Author

@dregad dregad commented on 8a0fb52 Oct 22, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-e flag might cause unexpected failures whereas the || approach selectively decides which errors should cause the script to error out. Feel free to test ;-)

@rombert
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated. Let's see what happens :-)

Please sign in to comment.