From e82c4f56e6f9a6bce4098698b17fa45dcc5bbd25 Mon Sep 17 00:00:00 2001 From: Tino Calancha Date: Wed, 2 Aug 2017 16:50:37 +0900 Subject: [PATCH] Don't assume /bin/sh as the 'sh' location in the local host * lisp/dired.el (dired-insert-directory): Use executable-find in a local host. --- lisp/dired.el | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lisp/dired.el b/lisp/dired.el index 4f8f615a34b..e1bedb6c73f 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -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))) -- 2.39.2