Skip to content

Commit

Permalink
stdlib: Set variables in log_error() only if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
tmatilai committed Jan 14, 2022
1 parent 17785e3 commit a6868a8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions stdlib.sh
Expand Up @@ -154,12 +154,12 @@ log_status() {
# log_error "Unable to find specified directory!"

log_error() {
local color_normal
local color_error
color_normal=$(tput sgr0)
color_error=$(tput setaf 1)
if [[ -n $DIRENV_LOG_FORMAT ]]; then
local msg=$*
local color_normal
local color_error
color_normal=$(tput sgr0)
color_error=$(tput setaf 1)
# shellcheck disable=SC2059,SC1117
printf "${color_error}${DIRENV_LOG_FORMAT}${color_normal}\n" "$msg" >&2
fi
Expand Down

0 comments on commit a6868a8

Please sign in to comment.