On 29/1/2025 12:22 am, Michael Albinus wrote:
Tramp in its regular mode tries to filter out ansi colors. I have no
experience with this in direct async processes.
I think comint hooks somehow might not be being triggered, I'm unsure.
For the following tramp method (note is just podmancp but with hardcoded
values and a different method name):
--8<---------------cut here---------------start------------->8---
(setq tjp/jam--tramp-method
`("jam"
(tramp-login-program ,tramp-podman-method)
(tramp-login-args (("exec")
("-it")
("-u" "jammy") ;
default user `jammy'
("--workdir"
"/home/jammy/project")
("%h")
("%l")))
(tramp-direct-async ("/bin/bash" "-c"))
(tramp-remote-shell "/bin/bash")
(tramp-remote-shell-login ("-l"))
(tramp-remote-shell-args ("-i" "-c"))
(tramp-copy-program ,tramp-podman-method)
(tramp-copy-args (("cp")))
(tramp-copy-file-name (("%h" ":") ("%f")))
(tramp-copy-recursive t)))
--8<---------------cut here---------------end--------------->8---
The direct-async command for project-compile invoked with `zig build
run` is:
--8<---------------cut here---------------start------------->8---
00:14:21.984757 tramp-handle-make-process (6) # podman exec -it -u jammy
--workdir /home/jammy/project jam-zevem /bin/bash -c cd
/home/jammy/project/ && ( env HISTFILE\=\~/.tramp_history
PATH\=/home/jammy/bin\:/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin
PAGER\= INSIDE_EMACS\=31.0.50\,compile\,tramp\:2.8.0-pre ENV\=\'\'
TMOUT\=0 LC_CTYPE\=\'\' CDPATH\= HISTORY\= MAIL\= MAILCHECK\= MAILPATH\=
PAGER\=cat autocorrect\= correct\= /bin/bash -c zig\ build\ run )
--8<---------------cut here---------------end--------------->8---
This results in raw output in the comint compilation buffer (shortened
example output):
--8<---------------cut here---------------start------------->8---
-*- mode: compilation; default-directory: "/jam:jam-zevem:~/project/" -*-
Compilation started at Wed Jan 29 01:26:26
zig build run
[?2026h[J[?2026l[J[2mrun
(0mq(B run zevem
(0mq(B zig build-exe zevem Debug native[31m 1 errors
[0m[0m[1msrc/evm.zig:58:7: [31merror: [0m[1mexpected ',' after field
--8<---------------cut here---------------end--------------->8---
That same method but with connection local variables removed so it does
not run as direct-async executes as:
--8<---------------cut here---------------start------------->8---
00:19:32.602333 tramp-send-command (6) # cd /home/jammy/project/ &&
exec <<'32f25f46d5ede8e4e8ee96edc987c393' env
PS1\=/jam\:jam-zevem\:/home/jammy/project/\ \#\$\
INSIDE_EMACS\=31.0.50\,compile\,tramp\:2.8.0-pre PAGER\= /bin/bash
(
zig build run
) </dev/tty
--8<---------------cut here---------------end--------------->8---
That results in the same output in the comint compilation buffer except
the escape codes have been processed and text is coloured red, bolded
etc etc.
Besides the double shell nesting on the direct-async one I'm not
immediately sure why. The added </dev/tty on the regular command is
sneaky but the direct-async version is still getting all the output.
I might try see if the comint hooks are being triggered. Besides editing
the first "/bin/bash -c" in the direct-async command there's nothing
else I can see to easily change how that command is executed for testing
here.
I'm recovering slowly from the OP. Your Tramp report(s) are still on my
todo; hope I'll be able to work on them soon.
I'm glad to hear it; your recovery that is!
/Jordan
P.S. Tacking on something here that I haven't investigated enough yet,
but there is a race condition between vc-refresh-state and friends and
Tramp. Whatever commands vc-refresh-state and friends want to run can
execute such Tramp sends a command and they read Tramp's output as their
own and then error. For example, those vc-refresh-state commands might
run and just after Tramp does some file stat'ing and then vc errors with
invalid data types showing its received Tramp's stat output.