]> git.eshelyaron.com Git - emacs.git/commitdiff
project--files-in-directory: Handle errors reported by 'find'
authorDmitry Gutov <dgutov@yandex.ru>
Fri, 16 Apr 2021 00:38:23 +0000 (03:38 +0300)
committerDmitry Gutov <dgutov@yandex.ru>
Fri, 16 Apr 2021 00:38:23 +0000 (03:38 +0300)
* lisp/progmodes/project.el (project--files-in-directory):
Handle errors reported by 'find' (bug#47799).

lisp/progmodes/project.el

index fdca4462f553a4a35ee1703d733a0314ab6f6e09..1edbe069a4c61d2ebb58db43118ceb3f84edd7bb 100644 (file)
@@ -312,9 +312,15 @@ to find the list of ignores for each directory."
                                        (concat " -o " find-name-arg " "))
                                       " "
                                       (shell-quote-argument ")"))
-                            ""))))
+                            "")))
+         (output (with-output-to-string
+                   (with-current-buffer standard-output
+                     (let ((status
+                            (process-file-shell-command command nil t)))
+                       (unless (zerop status)
+                         (error "File listing failed: %s" (buffer-string))))))))
     (project--remote-file-names
-     (sort (split-string (shell-command-to-string command) "\0" t)
+     (sort (split-string output "\0" t)
            #'string<))))
 
 (defun project--remote-file-names (local-files)