Scripts: Set errexit to catch errors
This commit is contained in:
committed by
Matthias Mailänder
parent
7cd0d8c079
commit
946cd8f322
@@ -1,4 +1,6 @@
|
||||
#!/bin/sh
|
||||
set -o errexit || exit $?
|
||||
|
||||
ENGINEDIR=$(dirname "$0")
|
||||
if command -v mono >/dev/null 2>&1 && [ "$(grep -c .NETCoreApp,Version= "${ENGINEDIR}/bin/OpenRA.dll")" = "0" ]; then
|
||||
RUNTIME_LAUNCHER="mono --debug"
|
||||
@@ -32,10 +34,10 @@ then
|
||||
fi
|
||||
|
||||
# Launch the engine with the appropriate arguments
|
||||
${RUNTIME_LAUNCHER} "${ENGINEDIR}/bin/OpenRA.dll" Engine.EngineDir=".." Engine.LaunchPath="${LAUNCHPATH}" ${MODARG} "$@"
|
||||
${RUNTIME_LAUNCHER} "${ENGINEDIR}/bin/OpenRA.dll" Engine.EngineDir=".." Engine.LaunchPath="${LAUNCHPATH}" ${MODARG} "$@" && rc=0 || rc=$?
|
||||
|
||||
# Show a crash dialog if something went wrong
|
||||
if [ $? != 0 ] && [ $? != 1 ]; then
|
||||
if [ "${rc}" != 0 ] && [ "${rc}" != 1 ]; then
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
LOGS="${HOME}/Library/Application Support/OpenRA/Logs/"
|
||||
else
|
||||
@@ -45,12 +47,14 @@ if [ $? != 0 ] && [ $? != 1 ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
test -d Support/Logs && LOGS="${PWD}/Support/Logs"
|
||||
if [ -d Support/Logs ]; then
|
||||
LOGS="${PWD}/Support/Logs"
|
||||
fi
|
||||
ERROR_MESSAGE=$(printf "%s has encountered a fatal error.\nPlease refer to the crash logs and FAQ for more information.\n\nLog files are located in %s\nThe FAQ is available at http://wiki.openra.net/FAQ" "OpenRA" "${LOGS}")
|
||||
if command -v zenity > /dev/null; then
|
||||
zenity --no-wrap --error --title "OpenRA" --no-markup --text "${ERROR_MESSAGE}" 2> /dev/null
|
||||
zenity --no-wrap --error --title "OpenRA" --no-markup --text "${ERROR_MESSAGE}" 2> /dev/null || :
|
||||
elif command -v kdialog > /dev/null; then
|
||||
kdialog --title "OpenRA" --error "${ERROR_MESSAGE}"
|
||||
kdialog --title "OpenRA" --error "${ERROR_MESSAGE}" || :
|
||||
else
|
||||
echo "${ERROR_MESSAGE}"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user