Closed bborysenko closed 6 years ago
Is there are way to use custom exit code?
#!/usr/bin/env bash source "$( cd "${BASH_SOURCE[0]%/*}" && pwd )/lib/oo-bootstrap.sh" import util/log util/exception util/tryCatch util/namedParameters util/class exit 1
$ ./your-script.sh; echo $? 0
Exception::CleanUp()
#!/usr/bin/env bash source "$( cd "${BASH_SOURCE[0]%/*}" && pwd )/lib/oo-bootstrap.sh" import util/log util/exception util/tryCatch util/namedParameters util/class Exception::CleanUp() { local exitVal=$? rm -f $__oo__storedExceptionLineFile $__oo__storedExceptionSourceFile $__oo__storedExceptionBacktraceFile $__oo__storedExceptionFile || exit 100 exit $exitVal } exit 1
$ ./your-script.sh; echo $? 1
#!/usr/bin/env bash source "$( cd "${BASH_SOURCE[0]%/*}" && pwd )/lib/oo-bootstrap.sh" import util/log util/exception util/tryCatch util/namedParameters util/class Exception::CleanUp() { local exitVal=$? rm -f $__oo__storedExceptionLineFile $__oo__storedExceptionSourceFile $__oo__storedExceptionBacktraceFile $__oo__storedExceptionFile || exit 10 exit $exitVal } class:Webhook() { Webhook.gitlab() { echo "GITLAB" } Webhook.handle() { [string] id case "$id" in gitlab) this $id ;; *) echo "Error" exit 1 ;; esac } } Type::Initialize Webhook Webhook webhook $var:webhook handle $1
$ ./your-script.sh gitlab; echo $? GITLAB 0 $ ./your-script.sh slack; echo $? Error 0
Thanks, fixed in master!
Is there are way to use custom exit code?
Exit code is always 0
Overide
Exception::CleanUp()
Exit command inside class