mirror of
https://github.com/avatao-content/test-tutorial-framework
synced 2024-11-15 03:37:17 +00:00
Unify traps in bootstrap scripts to avoid confusion
This commit is contained in:
parent
9ec0132e06
commit
a440c2d1cb
@ -18,8 +18,7 @@ LOGFILE=/tmp/bootstrap_tfw.log
|
|||||||
|
|
||||||
run()
|
run()
|
||||||
{
|
{
|
||||||
trap 'err_cleanup; showlog' ERR
|
trap handle_exit EXIT
|
||||||
trap cleanlog EXIT
|
|
||||||
: > $LOGFILE
|
: > $LOGFILE
|
||||||
|
|
||||||
check_dependencies
|
check_dependencies
|
||||||
@ -37,6 +36,15 @@ run()
|
|||||||
echo "You can build & start TFW by executing the command: ${TEST}/hack/tfw.sh start"
|
echo "You can build & start TFW by executing the command: ${TEST}/hack/tfw.sh start"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handle_exit()
|
||||||
|
{
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
err_cleanup
|
||||||
|
showlog
|
||||||
|
fi
|
||||||
|
cleanlog
|
||||||
|
}
|
||||||
|
|
||||||
showlog() { echo && echo "Error! Showing logs:" && cat $LOGFILE; }
|
showlog() { echo && echo "Error! Showing logs:" && cat $LOGFILE; }
|
||||||
cleanlog() { rm $LOGFILE; }
|
cleanlog() { rm $LOGFILE; }
|
||||||
err_cleanup() { cd "$BASEDIR" && rm -rf "$BASEIMAGE" "$FRONTEND" "$TEST"; }
|
err_cleanup() { cd "$BASEDIR" && rm -rf "$BASEIMAGE" "$FRONTEND" "$TEST"; }
|
||||||
|
Loading…
Reference in New Issue
Block a user