preserve exit code

This commit is contained in:
Frederick Zhang 2020-03-02 18:21:33 +11:00
parent aad3bb04a8
commit 4de06d21e0
No known key found for this signature in database
GPG key ID: 980A192C361BE1AE

View file

@ -10,6 +10,7 @@ function _do_sudo() {
local -a args
local -a cmd_alias_arr
local cmd_alias
local return_value
while (($#)); do
case "$1" in
command|exec|-) shift; break ;;
@ -43,8 +44,10 @@ function _do_sudo() {
else
PATH="/sbin:/usr/sbin:/usr/local/sbin:$PATH" command sudo "${args[@]}" $==*
fi
return_value=$?
unset __do_sudo_glob
unset __do_sudo_expanded
return $return_value
fi
}