Make stderr in Tramp's make-process more robust

* lisp/net/tramp-sh.el (tramp-sh-handle-make-process): Wrap about
error in inserting stderr file.

* lisp/net/tramp.el (tramp-handle-make-process): Fix docstring.
This commit is contained in:
Michael Albinus 2021-04-17 16:39:14 +02:00
parent 556c23cd17
commit 3430c12154
2 changed files with 8 additions and 5 deletions

View file

@ -2923,15 +2923,19 @@ alternative implementation will be used."
;; until the process is deleted.
(when (bufferp stderr)
(with-current-buffer stderr
(insert-file-contents-literally remote-tmpstderr))
;; There's a mysterious error, see
;; <https://github.com/joaotavora/eglot/issues/662>.
(ignore-errors
(insert-file-contents-literally remote-tmpstderr)))
;; Delete tmpstderr file.
(add-function
:after (process-sentinel p)
(lambda (_proc _msg)
(when (file-exists-p remote-tmpstderr)
(with-current-buffer stderr
(insert-file-contents-literally
remote-tmpstderr nil nil nil 'replace))
(ignore-errors
(insert-file-contents-literally
remote-tmpstderr nil nil nil 'replace)))
(delete-file remote-tmpstderr)))))
;; Return process.
p)))

View file

@ -3888,8 +3888,7 @@ substitution. SPEC-LIST is a list of char/value pairs used for
(or (not (stringp stderr)) (not (tramp-tramp-file-p stderr))))))
(defun tramp-handle-make-process (&rest args)
"An alternative `make-process' implementation for Tramp files.
It does not support `:stderr'."
"An alternative `make-process' implementation for Tramp files."
(when args
(with-parsed-tramp-file-name (expand-file-name default-directory) nil
(let ((default-directory (tramp-compat-temporary-file-directory))