Merge pull request #1357 from martgras/patch-1

avoid side effects in _printargs
This commit is contained in:
neil 2019-02-18 21:16:14 +08:00 committed by GitHub
commit 8f2a8a0051
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -139,6 +139,7 @@ __red() {
} }
_printargs() { _printargs() {
_exitstatus="$?"
if [ -z "$NO_TIMESTAMP" ] || [ "$NO_TIMESTAMP" = "0" ]; then if [ -z "$NO_TIMESTAMP" ] || [ "$NO_TIMESTAMP" = "0" ]; then
printf -- "%s" "[$(date)] " printf -- "%s" "[$(date)] "
fi fi
@ -148,6 +149,8 @@ _printargs() {
printf -- "%s" "$1='$2'" printf -- "%s" "$1='$2'"
fi fi
printf "\n" printf "\n"
# return the saved exit status
return "$_exitstatus"
} }
_dlg_versions() { _dlg_versions() {
@ -183,6 +186,7 @@ _dlg_versions() {
#class #class
_syslog() { _syslog() {
_exitstatus="$?"
if [ "${SYS_LOG:-$SYSLOG_LEVEL_NONE}" = "$SYSLOG_LEVEL_NONE" ]; then if [ "${SYS_LOG:-$SYSLOG_LEVEL_NONE}" = "$SYSLOG_LEVEL_NONE" ]; then
return return
fi fi
@ -196,6 +200,7 @@ _syslog() {
fi fi
fi fi
$__logger_i -t "$PROJECT_NAME" -p "$_logclass" "$(_printargs "$@")" >/dev/null 2>&1 $__logger_i -t "$PROJECT_NAME" -p "$_logclass" "$(_printargs "$@")" >/dev/null 2>&1
return "$_exitstatus"
} }
_log() { _log() {