From: Ihor Radchenko <yantar92@posteo.net>
To: Matt <matt@excalamus.com>
Cc: ParetoOptimal <pareto.optimal@mailfence.com>,
emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: [BUG] ob-shell async session does not work with multiple blocks running [9.7.16 (9.7.16-ba9734 @ /nix/store/6la93ywyb1h055phgyqba7h7qay60p0m-emacs-packages-deps/share/emacs/site-lisp/elpa/org-9.7.16/)]
Date: Tue, 10 Dec 2024 19:00:18 +0000 [thread overview]
Message-ID: <87r06fwegt.fsf@localhost> (raw)
In-Reply-To: <19383ad7efc.cd8c003b57730.3402192083670632266@excalamus.com>
Matt <matt@excalamus.com> writes:
> It's not clear to me what causes the observed behavior.
>
> Assigning '1' and '2' to the echoes in each block shows that the results for the second block are placed in the first:
> ...
What happens is related to the way ob-shell insert async indicators at
the beginning/end of the code block. The begin indicator is inserted
synchronously, while the end indicator is inserted _after_ the code
block is evaluated.
In the bug report, what happens is the following:
1. We call the first src bloc, async "begin" indicator is inserted into
the comint buffer immediately. The rest of the code is still running
2. We call the second src block, another "begin" indicator is inserted
...
3. _First_ src block finishes, inserting "end" indicator _after_ the
rest of the code, capturing both outputs
4. _Second_ src block finishes
This is what I see in the comint buffer
sh-5.2$ PROMPT_COMMAND=;PS1="𒆸 ";PS2=
𒆸 echo 'ob_comint_async_shell_start_2ecc6791-9a1a-4118-b6ea-434e8ea15b8b'
exec 2>&1
sleep 5
echo "almost done1"
sleep 3
echo "done1"
:
echo 'ob_comint_async_shell_end_2ecc6791-9a1a-4118-b6ea-434e8ea15b8b'
ob_comint_async_shell_start_2ecc6791-9a1a-4118-b6ea-434e8ea15b8b
𒆸 𒆸 echo 'ob_comint_async_shell_start_b3810f61-ab61-4895-b0a5-e75133f03a47'
exec 2>&1
sleep 1
echo "almost done2"
sleep 6
echo "done2"
:
echo 'ob_comint_async_shell_end_b3810f61-ab61-4895-b0a5-e75133f03a47'
𒆸 almost done1
𒆸 𒆸 done1
𒆸 𒆸 ob_comint_async_shell_end_2ecc6791-9a1a-4118-b6ea-434e8ea15b8b
𒆸 ob_comint_async_shell_start_b3810f61-ab61-4895-b0a5-e75133f03a47
𒆸 𒆸 𒆸 almost done2
𒆸 𒆸 done2
𒆸 𒆸 ob_comint_async_shell_end_b3810f61-ab61-4895-b0a5-e75133f03a47
𒆸
--
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
next prev parent reply other threads:[~2024-12-10 18:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-13 4:27 [BUG] ob-shell async session does not work with multiple blocks running [9.7.16 (9.7.16-ba9734 @ /nix/store/6la93ywyb1h055phgyqba7h7qay60p0m-emacs-packages-deps/share/emacs/site-lisp/elpa/org-9.7.16/)] ParetoOptimal
2024-11-23 18:43 ` Ihor Radchenko
2024-12-01 19:23 ` Matt
2024-12-10 19:00 ` Ihor Radchenko [this message]
2024-12-18 23:24 ` Matt
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.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r06fwegt.fsf@localhost \
--to=yantar92@posteo.net \
--cc=emacs-orgmode@gnu.org \
--cc=matt@excalamus.com \
--cc=pareto.optimal@mailfence.com \
/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.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
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).