1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-27 08:10:08 +00:00

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