unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* shell-command-to-string uses local shell for remote
@ 2019-03-31 19:28 Benedikt Tissot
  2019-04-01  6:36 ` Michael Albinus
  0 siblings, 1 reply; 2+ messages in thread
From: Benedikt Tissot @ 2019-03-31 19:28 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 976 bytes --]

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


[-- Attachment #2: Type: text/html, Size: 1419 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: shell-command-to-string uses local shell for remote
  2019-03-31 19:28 shell-command-to-string uses local shell for remote Benedikt Tissot
@ 2019-04-01  6:36 ` Michael Albinus
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Albinus @ 2019-04-01  6:36 UTC (permalink / raw)
  To: Benedikt Tissot; +Cc: emacs-devel

Benedikt Tissot <benedikt.tissot@googlemail.com> writes:

> Hello dear emacs maintainers,

Hi Benedikt,

> 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.

Have you tried a recent checkout from master? shell-command-to-string
uses the connection-local value of shell-file-name. On remote systems,
this is "/bin/sh" (or "/system/bin/sh" for the adb method) per default.

> Best regards,
> Benedikt Tissot

Best regards, Michael.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-04-01  6:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-31 19:28 shell-command-to-string uses local shell for remote Benedikt Tissot
2019-04-01  6:36 ` Michael Albinus

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).