die: Grab errorcode before doing anything else

This commit is contained in:
tastytea 2022-04-03 07:38:33 +02:00
parent 386fcc82bd
commit 9cefc87adf
Signed by: tastytea
SSH Key Fingerprint: SHA256:FBkvrOlhq5use1XEttyUGT4bUTDVA1ar9SgIc9P03cM

View File

@ -4,9 +4,10 @@
# number. Will return instead of exit when the shell is interactive.
# Put this in ${fpath} and load it with `autoload -U die`.
local errorcode=${?}
setopt LOCAL_OPTIONS ERR_RETURN NO_UNSET PIPE_FAIL
local errorcode=${?}
if [[ -v 1 && ${1} =~ '^[0-9]+$' ]]; then
errorcode=${1}
shift