Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to abort build if run script phase gives an error

I would like to use a run scripts target to tag my revision in mercurial and upload it to a server. I created a new run scripts target that depends on the other target building my app, then I added two run script phases directly one after another.

Now my question: how can I prevent executing run script phase #2 if run script phase #1 gives an error (return code of script is unequal 0)?

The second script would upload the files to a server, so I only want to execute this phase if everything went right until then.

like image 336
GorillaPatch Avatar asked Oct 06 '10 06:10

GorillaPatch


1 Answers

Your first script can abort the build with "exit 1", like this:

if [ error ] then
    echo "There are some errors, etc..."
    exit 1
fi
like image 71
Farhad Malekpour Avatar answered Sep 20 '22 11:09

Farhad Malekpour