Skip to content

Commit 1914fe3

Browse files
committed
fix(tryCatch): make it possible to exit with a non-zero status code (fixes #50)
1 parent 84c4511 commit 1914fe3

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

example/exitcode.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
3+
source "$( cd "${BASH_SOURCE[0]%/*}" && pwd )/../lib/oo-bootstrap.sh"
4+
5+
import util/exception util/tryCatch util/log util/test
6+
7+
exit 1

lib/util/tryCatch.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ Exception::SetupTemp() {
1414
}
1515

1616
Exception::CleanUp() {
17+
local exitVal=$?
1718
rm -f $__oo__storedExceptionLineFile $__oo__storedExceptionSourceFile $__oo__storedExceptionBacktraceFile $__oo__storedExceptionFile || exit 1
18-
exit 0
19+
exit $exitVal
1920
}
2021

2122
Exception::ResetStore() {

0 commit comments

Comments
 (0)