1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-05 22:20:24 -08:00

Extend Tramp direct async processes for further methods

* lisp/net/tramp-container.el (tramp-methods) <distrobox>:
* lisp/net/tramp-sh.el (tramp-methods) <sg>: Add `tramp-direct-async'.
(tramp-expand-script): Fix typo in script name.
(tramp-maybe-send-script): Adapt docstring.
This commit is contained in:
Michael Albinus 2025-11-11 16:40:33 +01:00
parent 4bb1b938df
commit b398a6c629
3 changed files with 15 additions and 6 deletions

View file

@ -701,8 +701,8 @@ see its function help for a description of the format."
(tramp-login-program ,tramp-distrobox-program)
(tramp-login-args (("enter")
("-n" "%h")
("--" "%l")))
;(tramp-direct-async (,tramp-default-remote-shell "-c"))
("--") ("%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 ("-c"))
@ -761,7 +761,14 @@ see its function help for a description of the format."
("--env"
,(format "TERM=%s" tramp-terminal-type))
("instance://%h")
("%h"))) ; Needed for multi-hop check.
;; Needed for multi-hop check,
;; ignored by the "shell" command.
("%h")))
;; `tramp-direct-async' must be used *instead* of `tramp-login-args'.
;; (tramp-direct-async (("exec")
;; ("--env"
;; ,(format "TERM=%s" tramp-terminal-type))
;; ("instance://%h"))
(tramp-remote-shell ,tramp-default-remote-shell)
(tramp-remote-shell-login ("-l"))
(tramp-remote-shell-args ("-c"))

View file

@ -172,6 +172,7 @@ They are completed by `M-x TAB' only in Tramp debug buffers."
(use-local-map special-mode-map)
(set-buffer-modified-p nil)
;; For debugging purposes.
;(add-hook 'kill-buffer-hook #'debug nil 'local)
(local-set-key "\M-n" 'clone-buffer)
(add-hook 'clone-buffer-hook #'tramp-setup-debug-buffer nil 'local))

View file

@ -303,6 +303,7 @@ The string is used in `tramp-methods'.")
`("sg"
(tramp-login-program "sg")
(tramp-login-args (("-") ("%u")))
(tramp-direct-async ("-c"))
(tramp-remote-shell ,tramp-default-remote-shell)
(tramp-remote-shell-args ("-c"))
(tramp-connection-timeout 10)))
@ -4073,8 +4074,8 @@ If VEC is nil, the respective local commands are used."
(bundle (when (string-match-p (rx (| bol (not "%")) "%b") script)
(tramp-maybe-send-script
vec tramp-bundle-read-file-names
"tramp_bundle_read_file-names")
"tramp_bundle_read_file-names"))
"tramp_bundle_read_file_names")
"tramp_bundle_read_file_names"))
(hdmp (when (string-match-p (rx (| bol (not "%")) "%h") script)
(or
(if vec (tramp-get-remote-hexdump vec)
@ -4142,7 +4143,7 @@ If VEC is nil, the respective local commands are used."
?p perl ?q test-e ?r readlink ?s stat ?t tmp ?y python)))))
(defun tramp-maybe-send-script (vec script name)
"Define in remote shell function NAME implemented as SCRIPT.
"Define a remote shell function NAME implemented as SCRIPT.
Only send the definition if it has not already been done."
;; We cannot let-bind (tramp-get-connection-process vec) because it
;; might be nil.