]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't try to make a pipe process for remote processes in Eshell
authorJim Porter <jporterbugs@gmail.com>
Mon, 23 Jan 2023 06:54:53 +0000 (22:54 -0800)
committerJim Porter <jporterbugs@gmail.com>
Mon, 23 Jan 2023 17:48:09 +0000 (09:48 -0800)
Tramp currently isn't able to handle this, so the result will just
produce an error (bug#61024).

* lisp/eshell/esh-proc.el (eshell-gather-process-output): Check for a
remote 'default-directory' before trying to make a pipe process.

* test/lisp/eshell/esh-proc-tests.el
(esh-var-test/output/remote-redirect): New test.

lisp/eshell/esh-proc.el
test/lisp/eshell/esh-proc-tests.el

index f1ec3a905b6d13b4f8b98d2d5b3b451c922b8aca..fcd59ab9f37270e4966c459d373219a2775f1a8b 100644 (file)
@@ -296,8 +296,13 @@ Used only on systems which do not support async subprocesses.")
                                                      'unix))))
     (cond
      ((fboundp 'make-process)
-      (unless (equal (car (aref eshell-current-handles eshell-output-handle))
-                     (car (aref eshell-current-handles eshell-error-handle)))
+      (unless (or ;; FIXME: It's not currently possible to use a
+                  ;; stderr process for remote files.
+                  (file-remote-p default-directory)
+                  (equal (car (aref eshell-current-handles
+                                    eshell-output-handle))
+                         (car (aref eshell-current-handles
+                                    eshell-error-handle))))
         (eshell-protect-handles eshell-current-handles)
         (setq stderr-proc
               (make-pipe-process
index ae7b1dddd697225cf90b5b74b21d48f70bdb23b4..8e02fbb549772cf5b97381749886014ff9d51f68 100644 (file)
@@ -19,6 +19,7 @@
 
 ;;; Code:
 
+(require 'tramp)
 (require 'ert)
 (require 'esh-mode)
 (require 'eshell)
       "\\`\\'"))
     (should (equal (buffer-string) "stdout\nstderr\n"))))
 
+(ert-deftest esh-var-test/output/remote-redirect ()
+  "Check that redirecting stdout for a remote process works."
+  (skip-unless (and (eshell-tests-remote-accessible-p)
+                    (executable-find "echo")))
+  (let ((default-directory ert-remote-temporary-file-directory))
+    (eshell-with-temp-buffer bufname "old"
+      (with-temp-eshell
+       (eshell-match-command-output
+        (format "*echo hello > #<%s>" bufname)
+        "\\`\\'"))
+      (should (equal (buffer-string) "hello\n")))))
+
 \f
 ;; Exit status