From 374b3282707db0355082578b435c21015a83edbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20Tri=C3=B1anes?= Date: Wed, 16 Apr 2025 11:58:53 +0200 Subject: [PATCH] Fix warnings not being printed --- direnvrc | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/direnvrc b/direnvrc index ada02d5..0930e20 100644 --- a/direnvrc +++ b/direnvrc @@ -15,16 +15,18 @@ _nix_direnv_info() { } _nix_direnv_warning() { - if [[ -n $DIRENV_LOG_FORMAT ]]; then - local msg=$* color_normal='' color_warning='' - if [[ -t 2 ]]; then - color_normal="\e[m" - color_warning="\e[33m" - fi - # shellcheck disable=SC2059 - printf "${color_warning}${DIRENV_LOG_FORMAT}${color_normal}\n" \ - "${_NIX_DIRENV_LOG_PREFIX}${msg}" >&2 + local msg=$* + local color_normal="" + local color_warning="" + + if [[ -t 2 ]]; then + color_normal="\e[m" + color_warning="\e[33m" fi + + printf "%b" "$color_warning" + log_status "${_NIX_DIRENV_LOG_PREFIX}${msg}" + printf "%b" "$color_normal" } _nix_direnv_error() { log_error "${_NIX_DIRENV_LOG_PREFIX}$*"; }