summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2022-11-21 14:49:54 +0100
committerMichael Albinus <michael.albinus@gmx.de>2022-11-21 14:49:54 +0100
commit61e96789ddb1fe81520c3b1cc6c7ff43da5bc26f (patch)
tree037f438720579fedeac84cda0ab0fc0ca7675919
parenta3b654e069e563b0a2a6335ec310ada51400ac09 (diff)
downloademacs-61e96789ddb1fe81520c3b1cc6c7ff43da5bc26f.tar.gz
Activate direct asynchronous processes for Tramp container methods
* 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'.
-rw-r--r--doc/misc/tramp.texi5
-rw-r--r--lisp/emacs-lisp/ert-x.el1
-rw-r--r--lisp/net/tramp-container.el3
-rw-r--r--lisp/net/tramp.el14
-rw-r--r--test/lisp/net/tramp-tests.el7
5 files changed, 22 insertions, 8 deletions
diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi
index 19f82b2447b..403c0daa67b 100644
--- a/doc/misc/tramp.texi
+++ b/doc/misc/tramp.texi
@@ -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
diff --git a/lisp/emacs-lisp/ert-x.el b/lisp/emacs-lisp/ert-x.el
index a891f068a70..49f2a1d6965 100644
--- a/lisp/emacs-lisp/ert-x.el
+++ b/lisp/emacs-lisp/ert-x.el
@@ -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)))
diff --git a/lisp/net/tramp-container.el b/lisp/net/tramp-container.el
index 328625b7765..7b942532267 100644
--- a/lisp/net/tramp-container.el
+++ b/lisp/net/tramp-container.el
@@ -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"))))
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index b08bc63e8a2..e9f30bea7bf 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -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
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 46fef558bf2..a5bae46a583 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -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