[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [BUG] ob-shell async session does not work with multiple blocks runn
From: |
Ihor Radchenko |
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 |
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>