Commit 3bc3dc40 authored by Dmitry Gutov's avatar Dmitry Gutov
Browse files

Signal error if find-grep returns a nonzero status

* lisp/progmodes/xref.el (xref-collect-matches): Signal error
if find-grep returns a nonzero status (bug#23451).  Remove the
comment: even if some output is present, a non-zero status
means something went wrong and it can't be relied upon.
parent d76c0078
......@@ -929,14 +929,16 @@ IGNORES is a list of glob patterns."
(buf (get-buffer-create " *xref-grep*"))
(grep-re (caar grep-regexp-alist))
(with-current-buffer buf
(call-process-shell-command command nil t)
;; FIXME: What to do when the call fails?
;; "find: ‘xyzgrep’: No such file or directory\n"
;; The problem is, find-grep can exit with a nonzero code even
;; when there are some matches in the output.
(setq status
(call-process-shell-command command nil t))
(when (and (not (zerop status))
;; Nonzero status can mean "no matches found".
(/= (point-min) (point-max)))
(user-error "Search failed with status %d: %s" status (buffer-string)))
(goto-char (point-min))
(while (re-search-forward grep-re nil t)
(push (list (string-to-number (match-string 2))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment