diff --git a/example/exitcode.sh b/example/exitcode.sh new file mode 100644 index 0000000..3f629ba --- /dev/null +++ b/example/exitcode.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +source "$( cd "${BASH_SOURCE[0]%/*}" && pwd )/../lib/oo-bootstrap.sh" + +import util/exception util/tryCatch util/log util/test + +exit 1 diff --git a/lib/util/tryCatch.sh b/lib/util/tryCatch.sh index a69b976..278bddf 100644 --- a/lib/util/tryCatch.sh +++ b/lib/util/tryCatch.sh @@ -14,8 +14,9 @@ Exception::SetupTemp() { } Exception::CleanUp() { + local exitVal=$? rm -f $__oo__storedExceptionLineFile $__oo__storedExceptionSourceFile $__oo__storedExceptionBacktraceFile $__oo__storedExceptionFile || exit 1 - exit 0 + exit $exitVal } Exception::ResetStore() {