From 3bed63205c5cf77c2eda85666ddc7b499b1e9475 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Wed, 28 Nov 2012 10:50:21 +0200 Subject: [PATCH] Better error handling --- minetest-worldtest-check-and-set.sh | 4 ++-- minetest-worldtest.sh | 12 ++++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/minetest-worldtest-check-and-set.sh b/minetest-worldtest-check-and-set.sh index 12a33b7..f91e557 100755 --- a/minetest-worldtest-check-and-set.sh +++ b/minetest-worldtest-check-and-set.sh @@ -15,10 +15,10 @@ worlddir=$2 #echo "-- Making world in $worlddir using $gamedir" echo "-- Making world `basename $worlddir`" -pushd "$gamedir" &>/dev/null +pushd "$gamedir" &>/dev/null || exit 1 # Configuration file is the common runtime configuration method echo -e "map-dir = $worlddir\nenable_mapgen_debug_info = true\n" > worldtest_config -mkdir -p "$worlddir" +mkdir -p "$worlddir" || exit 1 if ! [ -a "$worlddir/world.mt" ]; then echo -e 'gameid = minimal' > "$worlddir/world.mt" fi diff --git a/minetest-worldtest.sh b/minetest-worldtest.sh index a7a5c72..d354f9c 100755 --- a/minetest-worldtest.sh +++ b/minetest-worldtest.sh @@ -50,11 +50,11 @@ build_minetest () pkg=$3 mtdir=$4 - rm -rf "$mtdir" - mkdir -p "$mtdir" - pushd "$mtdir" &>/dev/null + rm -rf "$mtdir" || return 1 + mkdir -p "$mtdir" || return 1 + pushd "$mtdir" &>/dev/null || return 1 # Extract package - tar -xf "$pkg" + tar -xf "$pkg" || return 1 # Patch stuff for patchfile in $ruledir/*.patch; do @@ -71,6 +71,10 @@ build_minetest () # Build it cmake . -DRUN_IN_PLACE=1 -DBUILD_CLIENT=0 + if [ "$?" == "1" ]; then + echo "EE Error preparing build for $tag" + return 1 + fi make -j2 if [ "$?" == "1" ]; then echo "EE Error building $tag"