]> git.eshelyaron.com Git - emacs.git/commitdiff
Activate direct asynchronous processes for Tramp container methods
authorMichael Albinus <michael.albinus@gmx.de>
Mon, 21 Nov 2022 13:49:54 +0000 (14:49 +0100)
committerMichael Albinus <michael.albinus@gmx.de>
Mon, 21 Nov 2022 13:49:54 +0000 (14:49 +0100)
* doc/misc/tramp.texi (Remote processes): Mention also
tramp-container.el.

* lisp/emacs-lisp/ert-x.el (ert-remote-temporary-file-directory):
Add `tramp-direct-async' to "mock" method.

* lisp/net/tramp-container.el
(tramp-methods) <docker, podman, kubernetes>: Add `tramp-direct-async'.

* lisp/net/tramp.el (tramp-methods): Adapt docstring.
(tramp-handle-make-process): Handle `tramp-direct-async'.

* test/lisp/net/tramp-tests.el (tramp-methods) <mock>:
Add `tramp-direct-async'.

doc/misc/tramp.texi
lisp/emacs-lisp/ert-x.el
lisp/net/tramp-container.el
lisp/net/tramp.el
test/lisp/net/tramp-tests.el

index 19f82b2447b30457f6f199a9fdc9fae92e438815..403c0daa67b8fea3d37a2c987f4ffc40e1999385 100644 (file)
@@ -4253,8 +4253,9 @@ Furthermore, this approach has the following limitations:
 
 @itemize
 @item
-It works only for connection methods defined in @file{tramp-adb.el},
-@file{tramp-sh.el} and @file{tramp-sshfs.el}.
+It works only for some connection methods defined in
+@file{tramp-adb.el}, @file{tramp-container.el}, @file{tramp-sh.el} and
+@file{tramp-sshfs.el}.
 
 @item
 It does not support interactive user authentication.  With
index a891f068a70b87cf40351f81030ec628a4982c34..49f2a1d69656801ffa936d4a807bc82fae8fdf5d 100644 (file)
@@ -560,6 +560,7 @@ The same keyword arguments are supported as in
          '("mock"
           (tramp-login-program      "sh")
           (tramp-login-args         (("-i")))
+           (tramp-direct-async       ("-c"))
           (tramp-remote-shell       "/bin/sh")
           (tramp-remote-shell-args  ("-c"))
           (tramp-connection-timeout 10)))
index 328625b7765450de6b00349b0415fa356204361b..7b942532267537d76ba2ec5347174438894fb213 100644 (file)
@@ -163,6 +163,7 @@ see its function help for a description of the format."
                                    ("-u" "%u")
                                    ("%h")
                                   ("%l")))
+               (tramp-direct-async (,tramp-default-remote-shell "-c"))
                 (tramp-remote-shell ,tramp-default-remote-shell)
                 (tramp-remote-shell-login ("-l"))
                 (tramp-remote-shell-args ("-i" "-c"))))
@@ -174,6 +175,7 @@ see its function help for a description of the format."
                                    ("-u" "%u")
                                    ("%h")
                                   ("%l")))
+               (tramp-direct-async (,tramp-default-remote-shell "-c"))
                 (tramp-remote-shell ,tramp-default-remote-shell)
                 (tramp-remote-shell-login ("-l"))
                 (tramp-remote-shell-args ("-i" "-c"))))
@@ -186,6 +188,7 @@ see its function help for a description of the format."
                                    ("--")
                                   ("%l")))
                (tramp-config-check tramp-kubernetes--current-context-data)
+               (tramp-direct-async (,tramp-default-remote-shell "-c"))
                 (tramp-remote-shell ,tramp-default-remote-shell)
                 (tramp-remote-shell-login ("-l"))
                 (tramp-remote-shell-args ("-i" "-c"))))
index b08bc63e8a2972e1a536737660e9af47f77e06b2..e9f30bea7bf4af1e504ca07e79a64aa2b8ebd3ec 100644 (file)
@@ -278,8 +278,9 @@ pair of the form (KEY VALUE).  The following KEYs are defined:
 
   * `tramp-direct-async'
     Whether the method supports direct asynchronous processes.
-    Until now, just \"ssh\"-based, \"sshfs\"-based and
-    \"adb\"-based methods do.
+    Until now, just \"ssh\"-based, \"sshfs\"-based, \"adb\"-based
+    and container methods do.  If it is a list of strings, they
+    are used to construct the remote command.
 
   * `tramp-config-check'
     A function to be called with one argument, VEC.  It should
@@ -4804,7 +4805,14 @@ substitution.  SPEC-LIST is a list of char/value pairs used for
               (command
                (append
                 `("cd" ,(tramp-shell-quote-argument localname) "&&" "(" "env")
-                env `(,command ")"))))
+                env `(,command ")")))
+               ;; Add remote shell if needed.
+              (command
+               (if (consp (tramp-get-method-parameter v 'tramp-direct-async))
+                   (append
+                    (tramp-get-method-parameter v 'tramp-direct-async)
+                     `(,(mapconcat #'identity command " ")))
+                 command)))
 
          ;; Check for `tramp-sh-file-name-handler', because something
          ;; is different between tramp-sh.el, and tramp-adb.el or
index 46fef558bf2fdc3b296247696d1db436010b0b2f..a5bae46a583f2adb50cea7b9fb4fd9aa2537f9be 100644 (file)
@@ -140,10 +140,11 @@ A resource file is in the resource directory as per
        ((eq system-type 'windows-nt) null-device)
        (t (add-to-list
            'tramp-methods
-           '("mock"
-            (tramp-login-program       "sh")
+           `("mock"
+            (tramp-login-program       ,tramp-default-remote-shell)
             (tramp-login-args          (("-i")))
-            (tramp-remote-shell        "/bin/sh")
+             (tramp-direct-async       ("-c"))
+            (tramp-remote-shell        ,tramp-default-remote-shell)
             (tramp-remote-shell-args   ("-c"))
             (tramp-connection-timeout  10)))
           (add-to-list