Update lib-core.sh

This commit is contained in:
Vince
2026-05-25 13:19:29 +08:00
parent f60a6981aa
commit a83f467e4c

View File

@@ -744,6 +744,18 @@ sudo() {
udo() {
local result="0"
if [[ "$(id -un)" == "${MY_USERNAME}" ]]; then
if [[ -p /dev/stdin ]]; then
"${@}" < /dev/stdin || result="${?}"
else
"${@}" || result="${?}"
fi
[[ "${result}" != "0" ]] && MACTAHOE_COMMAND="${*}"
return "${result}"
fi
# Just in case. We put the prompt here to make it less annoying
if ! ${SUDO_BIN} -u "${MY_USERNAME}" -n true &> /dev/null; then
prompt -w "Executing '$(echo "${@}" | cut -c -35 )...' as user"