]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't assume /bin/sh as the 'sh' location in the local host
authorTino Calancha <tino.calancha@gmail.com>
Wed, 2 Aug 2017 07:50:37 +0000 (16:50 +0900)
committerTino Calancha <tino.calancha@gmail.com>
Wed, 2 Aug 2017 07:50:44 +0000 (16:50 +0900)
* lisp/dired.el (dired-insert-directory): Use executable-find in
a local host.

lisp/dired.el

index 4f8f615a34b2e3521f50c3addb7b043e22b7ce92..e1bedb6c73fd0ad4ba28066e3560ccc8b93ebc47 100644 (file)
@@ -1276,12 +1276,17 @@ see `dired-use-ls-dired' for more details.")
              ;; call for wildcards.
              (when (file-remote-p dir)
                (setq switches (dired-replace-in-string "--dired" "" switches)))
-             (let ((default-directory (car dir-wildcard))
-                   (script (format "ls %s %s" switches (cdr dir-wildcard))))
+             (let* ((default-directory (car dir-wildcard))
+                    (script (format "ls %s %s" switches (cdr dir-wildcard)))
+                    (remotep (file-remote-p dir))
+                    (sh (or (and remotep "/bin/sh")
+                            (and (bound-and-true-p explicit-shell-file-name)
+                                 (executable-find explicit-shell-file-name))
+                            (executable-find "sh")))
+                    (switch (if remotep "-c" shell-command-switch)))
                (unless
                    (zerop
-                    (process-file
-                     "/bin/sh" nil (current-buffer) nil "-c" script))
+                    (process-file sh nil (current-buffer) nil switch script))
                  (user-error
                   "%s: No files matching wildcard" (cdr dir-wildcard)))
                (insert-directory-clean (point) switches)))