From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id SBmuHaqPWGdWvgAAqHPOHw:P1 (envelope-from ) for ; Tue, 10 Dec 2024 18:59:54 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id SBmuHaqPWGdWvgAAqHPOHw (envelope-from ) for ; Tue, 10 Dec 2024 19:59:54 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=byfsmqNe; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=posteo.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1733857194; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=MNZFJm5cdwHME/81JH1sS1ZwXWLKZzo8DF0JhAqX+qI=; b=pXiu7bnJVQh5Z98/7GR7pnWw2hBdlk9M32J297jPQfp/FRQgPlkwifOqe2WdK95JkbM5+Z oQ8vHuTRkuhSgmfqKR+KxA7VPXOFus01udjn6ohDUG+VQlifh2VKF1jHSWAzxQ9tIxtCXN oy6VpjlyaS6Al1GYDAsL/tEiT3QBZNYaejA5Nm1+jVhsRaeoNmIIuK1dy1prOCunqoh+Oz Lruf9KpEdgwDymKT5pmLHCCsNjc3rV+jq16LsqA3333t8Whlufm+z/kmFJF0HZne4aOZO5 3DHQ9AWgCA2xi/xfKuAaGqCSGbrH2jm4RZyUcHHzSKOEkVFsQEo73nQrrBk21A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=byfsmqNe; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=posteo.net ARC-Seal: i=1; s=key1; d=yhetil.org; t=1733857194; a=rsa-sha256; cv=none; b=nlGa+Ll6/hCQtnW61BVLgf8oyYwo4j2Fyf5iqGVI0A2XOhLY2P0qXh50tYjGoMvxFze34F R4+ps7AkcC4Y5GijmD9jb6AQ3VqoVNyzK7STcmYQCj6B8jxHXGNo/At6A6Ay2o0Yu4lN0L mRrhowI/lLwVyx/HuWvKot1kkKaJhFDbyKoDUWBvl03f7al49lk9nPkH4junaXsiiOv/7z caplisgpMFDF3UV/cN95yM0mk2jrFh46OaJzM9kX136CSzrkbhpCAszyXn4CGig1aGTyqB mdtpnZSCURR8/R7pTJd79ziXCz8cn8zSthwz3tJAQW0hITgCBD3BQtlBBgcL+g== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 3970341C11 for ; Tue, 10 Dec 2024 19:59:54 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL5Ri-0006P3-3z; Tue, 10 Dec 2024 13:58:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tL5Rg-0006Ot-Ux for emacs-orgmode@gnu.org; Tue, 10 Dec 2024 13:58:56 -0500 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tL5Re-0007cz-Nl for emacs-orgmode@gnu.org; Tue, 10 Dec 2024 13:58:56 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id E0780240101 for ; Tue, 10 Dec 2024 19:58:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1733857128; bh=5ttu+QfqA0JYGLPOuFK35g6MYPvVhKpjFy0LNUxNztM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: Content-Transfer-Encoding:From; b=byfsmqNe0rdn/ZLIsxp9Nd1BRvzkZ2Uu/POtSF99KZS2g7ymGz8YcSTzTTVLCkueD UD66Oom4l4TC3b0ZE1d473BwG1sR+85LSE+aLEbwe/fVMGdhCmE4nCYuhzFNbpgEh9 PwM4ZqZk8QqqQvoa+G/5FUJGe1LUEbNa2hBM03CkOcIVCsKf6usRt5YExJsnpQ4G31 GQ5PYFJ7LuEwNfZodtJmLz6XQ4cA6yHQvALfgNHdNpZ6iNEk+hA3kcK3JnP32RI0Sj dOxmRg122Mjswr7HTA0R5iljqt2BuFApsy1K9gUVrz75pqX/yufcwBgcj3Vpv8kX0Q Nzm4ENuFc1yYQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Y77LH70Pfz9rxP; Tue, 10 Dec 2024 19:58:47 +0100 (CET) From: Ihor Radchenko To: Matt Cc: ParetoOptimal , emacs-orgmode 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/)] In-Reply-To: <19383ad7efc.cd8c003b57730.3402192083670632266@excalamus.com> References: <87zfm369mt.fsf@mailfence.com> <877c8t4wph.fsf@localhost> <19383ad7efc.cd8c003b57730.3402192083670632266@excalamus.com> Date: Tue, 10 Dec 2024 19:00:18 +0000 Message-ID: <87r06fwegt.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Scanner: mx11.migadu.com X-Migadu-Spam-Score: -3.37 X-Spam-Score: -3.37 X-Migadu-Queue-Id: 3970341C11 X-TUID: jV1uGdFEq9Ih Matt writes: > It's not clear to me what causes the observed behavior.=20=20 > > 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=3D;PS1=3D"=F0=92=86=B8=EF=BB=BF ";PS2=3D =F0=92=86=B8=EF=BB=BF 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 =F0=92=86=B8=EF=BB=BF =F0=92=86=B8=EF=BB=BF echo 'ob_comint_async_shell_sta= rt_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' =F0=92=86=B8=EF=BB=BF almost done1 =F0=92=86=B8=EF=BB=BF =F0=92=86=B8=EF=BB=BF done1 =F0=92=86=B8=EF=BB=BF =F0=92=86=B8=EF=BB=BF ob_comint_async_shell_end_2ecc6= 791-9a1a-4118-b6ea-434e8ea15b8b =F0=92=86=B8=EF=BB=BF ob_comint_async_shell_start_b3810f61-ab61-4895-b0a5-e= 75133f03a47 =F0=92=86=B8=EF=BB=BF =F0=92=86=B8=EF=BB=BF =F0=92=86=B8=EF=BB=BF almost do= ne2 =F0=92=86=B8=EF=BB=BF =F0=92=86=B8=EF=BB=BF done2 =F0=92=86=B8=EF=BB=BF =F0=92=86=B8=EF=BB=BF ob_comint_async_shell_end_b3810= f61-ab61-4895-b0a5-e75133f03a47 =F0=92=86=B8=EF=BB=BF=20 --=20 Ihor Radchenko // yantar92, Org mode maintainer, Learn more about Org mode at . Support Org development at , or support my work at