From edd4996a4f89ba56cec018a23ca74aed2ac96d35 Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Tue, 8 Jul 2025 15:50:14 -0400 Subject: [PATCH] fix(fsext): only log warnings if log is initialized --- internal/fsext/fileutil.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/internal/fsext/fileutil.go b/internal/fsext/fileutil.go index e350b61f6c4fd02c0088cc1f2f5c35c0bbc45259..677613ffc047919c7cf888a888da8ccbce7ea585 100644 --- a/internal/fsext/fileutil.go +++ b/internal/fsext/fileutil.go @@ -12,6 +12,7 @@ import ( "github.com/bmatcuk/doublestar/v4" "github.com/charlievieth/fastwalk" + "github.com/charmbracelet/crush/internal/log" ignore "github.com/sabhiram/go-gitignore" ) @@ -25,11 +26,15 @@ func init() { var err error rgPath, err = exec.LookPath("rg") if err != nil { - slog.Warn("Ripgrep (rg) not found in $PATH. Some features might be limited or slower.") + if log.IsInitialized() { + slog.Warn("Ripgrep (rg) not found in $PATH. Some features might be limited or slower.") + } } fzfPath, err = exec.LookPath("fzf") if err != nil { - slog.Warn("FZF not found in $PATH. Some features might be limited or slower.") + if log.IsInitialized() { + slog.Warn("FZF not found in $PATH. Some features might be limited or slower.") + } } }