emacs-devel
[Top][All Lists]
Advanced

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

shell-command-to-string uses local shell for remote


From: Benedikt Tissot
Subject: shell-command-to-string uses local shell for remote
Date: Sun, 31 Mar 2019 21:28:10 +0200

Hello dear emacs maintainers,

If the local used shell does not exist on the remote the shell-command-to-string function from simple.el does not work as expected. The reason for this is that the variable shell-file-name is wrong and therefore one only gets a string saying that the shell does not exist.
Changing the function to 
(defun shell-command-to-string (command)
  "Execute shell command COMMAND and return its output as a string."
  (with-output-to-string
    (with-current-buffer
      standard-output
      (let ((shell-file-name
             (with-temp-buffer
               (apply #'process-file "printenv" nil t nil '("SHELL"))
               (string-trim-right (buffer-string)))))
        (process-file shell-file-name nil t nil shell-command-switch command)))))
does work for remotes that do not have the local shell, too.
I hope this is the right place for this and additionally wanted to thank you for maintaining emacs.

Best regards,
Benedikt Tissot

reply via email to

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