Skip to content

Commit e87fd8a

Browse files
committed
fix: validate fd --version output
Ref: https://discourse.doomemacs.org/t/3144
1 parent 71e0190 commit e87fd8a

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

lisp/doom-projects.el

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -177,22 +177,20 @@ And if it's a function, evaluate it."
177177
;; program that is significantly faster than git ls-files or find, and
178178
;; it respects .gitignore. This is recommended in the projectile docs.
179179
(cond
180-
((when-let
181-
(bin (if (ignore-errors (file-remote-p default-directory nil t))
182-
(cl-find-if (doom-rpartial #'executable-find t)
183-
(list "fdfind" "fd"))
184-
doom-projectile-fd-binary))
185-
;; REVIEW Temporary fix for #6618. Improve me later.
186-
(let ((version (or doom-projects--fd-version
187-
(cadr (split-string (cdr (doom-call-process bin "--version"))
188-
" " t)))))
189-
(when version
190-
(setq doom-projects--fd-version version))
180+
((when-let*
181+
((bin (if (ignore-errors (file-remote-p default-directory nil t))
182+
(cl-find-if (doom-rpartial #'executable-find t)
183+
(list "fdfind" "fd"))
184+
doom-projectile-fd-binary))
185+
;; REVIEW Temporary fix for #6618. Improve me later.
186+
(version (with-memoization doom-projects--fd-version
187+
(cadr (split-string (cdr (doom-call-process bin "--version"))
188+
" " t))))
189+
((ignore-errors (version-to-list version))))
191190
(concat (format "%s . -0 -H --color=never --type file --type symlink --follow --exclude .git %s"
192-
bin (if (and (stringp version)
193-
(version< version "8.3.0"))
191+
bin (if (version< version "8.3.0")
194192
"" "--strip-cwd-prefix"))
195-
(if IS-WINDOWS " --path-separator=/")))))
193+
(if IS-WINDOWS " --path-separator=/"))))
196194
;; Otherwise, resort to ripgrep, which is also faster than find
197195
((executable-find "rg" t)
198196
(concat "rg -0 --files --follow --color=never --hidden -g!.git"

0 commit comments

Comments
 (0)