emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master e82c4f5: Don't assume /bin/sh as the 'sh' location


From: Tino Calancha
Subject: [Emacs-diffs] master e82c4f5: Don't assume /bin/sh as the 'sh' location in the local host
Date: Wed, 2 Aug 2017 03:55:00 -0400 (EDT)

branch: master
commit e82c4f56e6f9a6bce4098698b17fa45dcc5bbd25
Author: Tino Calancha <address@hidden>
Commit: Tino Calancha <address@hidden>

    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 4f8f615..e1bedb6 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)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]