From: Emanuel Berg <incal@dataswamp.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Async process sentinel running exclusively in main thread?
Date: Tue, 21 Jun 2022 08:29:42 +0200 [thread overview]
Message-ID: <87ilou7cmh.fsf@dataswamp.org> (raw)
In-Reply-To: 878rpq5z9y.fsf@alternativebit.fr
Félix Baylac Jacqué wrote:
> (defun h--tests-init-fake-git-repo (dir)
> "Create a dummy git repo at DIR.
>
> If DIR doesn't exist, we create it first."
> (let* ((d (file-name-as-directory dir))
> (exit-code 0)
Not used ...
> (git-process
> (progn
> (make-directory d t)
> (h--call-git-in-dir d
> (lambda (ec) (setq exit-code ec))
> "init"))))
> (progn
Not needed.
> (unless (file-directory-p d) (make-directory d t))
> ;; ERT does not handle async processes gracefully for the time
> ;; being. Blocking and waiting for the git process to exit
> ;; before moving on.
> (while (accept-process-output git-process)))))
In the docstring it doesn't say the BODY of `while' is
optional, but I just tried and it works.
Here, try it yourself, it'll hang your computer:
(while t)
Ha. Just kidding ...
> (defun test-make-process ()
> (let* ((run-async-process
> (lambda ()
> (progn
Not needed.
> (message (format "run-async-process thread: %s"
> (prin1-to-string(current-thread))))
You don't need `message' and then `format',
(message "%s number %d" "Elisp programmer" 1) ; "Elisp programmer number 1"
> (make-process
> :name "dummy-async-subprocess"
> :buffer "sleep-buf"
> :command '("sleep" "5"))))))
> (progn
Not needed.
> (setq process (make-thread run-async-process))
Free variable, first use `defvar' if it should be global.
--
underground experts united
https://dataswamp.org/~incal
prev parent reply other threads:[~2022-06-21 6:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-20 8:43 Async process sentinel running exclusively in main thread? Félix Baylac Jacqué
2022-06-20 11:23 ` Eli Zaretskii
2022-06-21 6:03 ` Félix Baylac Jacqué
2022-06-21 6:29 ` Emanuel Berg [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ilou7cmh.fsf@dataswamp.org \
--to=incal@dataswamp.org \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).