help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Issue with remote async processes.


From: Michael Albinus
Subject: Re: Issue with remote async processes.
Date: Fri, 25 Mar 2022 09:55:55 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Ergus <spacibba@aol.com> writes:

> Hi:

Hi,

> I have this simple code:
>
> (defun my/async-sentinel (process _msg)
>   "Sentinel function for an asynchronous counsel PROCESS."
>   (when (eq (process-status process) 'exit)
>     (with-current-buffer " *string-output*"
>       (while (accept-process-output process))
>       (message "%s" (buffer-substring-no-properties (point-min) 
> (point-max))))))
>
> (let ((my/output (generate-new-buffer " *string-output*" t))
>       process)
>   (with-connection-local-variables
>    (setq process (start-file-process "myls" my/output "ls"))
>    (set-process-sentinel process #'my/async-sentinel)))
>
> This works in local processes without issues, but on remote I don't get
> any output.  Probably it is an error in the code, but I don't understand
> what's missing. And something similar to this used to work before.
>
> Any help please?

You call (generate-new-buffer " *string-output*" t) which means several
instances of this buffer might exist in parallel, with different
names. So you cannot expect, that

--8<---------------cut here---------------start------------->8---
(with-current-buffer " *string-output*"
--8<---------------cut here---------------end--------------->8---

works. Instead, use

--8<---------------cut here---------------start------------->8---
(with-current-buffer (process-buffer process)
--8<---------------cut here---------------end--------------->8---

Best regards, Michael.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]