detect failed unity launch and retry
This commit is contained in:
parent
091b078713
commit
131e8f8792
26
ci/build.sh
26
ci/build.sh
|
@ -12,6 +12,9 @@ echo "removing previous editor log..."
|
|||
|
||||
echo "starting build using unity v$unityversion..."
|
||||
|
||||
unitypid=-1
|
||||
|
||||
launch_unity () {
|
||||
# launch unity in batch mode
|
||||
open -g $editorpath --args \
|
||||
-batchmode \
|
||||
|
@ -22,18 +25,37 @@ open -g $editorpath --args \
|
|||
-logFile $editorlogpath \
|
||||
-projectPath "$(pwd)/game"
|
||||
|
||||
# wait for editor log to exist
|
||||
unitypid=`pgrep -n Unity`
|
||||
echo "launched unity ($pid)"
|
||||
}
|
||||
|
||||
launch_unity
|
||||
|
||||
tries=60
|
||||
count=0
|
||||
while [ ! -f $editorlogpath ]
|
||||
do
|
||||
if ps -p $unitypid > /dev/null
|
||||
then
|
||||
echo "unity ok ($unitypid)"
|
||||
else
|
||||
echo "unity is no longer running - trying again"
|
||||
|
||||
# reset launch attempts
|
||||
count=0
|
||||
launch_unity
|
||||
|
||||
continue
|
||||
fi
|
||||
|
||||
# wait a second
|
||||
sleep 1
|
||||
|
||||
# decrement
|
||||
count=`expr $count + 1`
|
||||
|
||||
if [ $count -eq $tries ] ; then
|
||||
echo "early timeout - $tries seconds elapsed since launch attempt"
|
||||
echo "early timeout - $tries seconds elapsed since last launch attempt"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
|
Loading…
Reference in New Issue