From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id 40y1HohMUmQZAAAASxT56A (envelope-from ) for ; Wed, 03 May 2023 13:59:04 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id CNazHYhMUmQjAgEAauVa8A (envelope-from ) for ; Wed, 03 May 2023 13:59:04 +0200 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 094802F929 for ; Wed, 3 May 2023 13:59:04 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1puB7k-0003g8-VZ; Wed, 03 May 2023 07:58:20 -0400 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 1puB7h-0003fe-Ld for emacs-orgmode@gnu.org; Wed, 03 May 2023 07:58:17 -0400 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 1puB7d-0002Kb-T1 for emacs-orgmode@gnu.org; Wed, 03 May 2023 07:58:17 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 882E124045D for ; Wed, 3 May 2023 13:58:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1683115090; bh=YQSPp7tU9aUP9rxcOrgbJoKh15R9PHUUaujYwKfM9po=; h=From:To:Cc:Subject:Date:From; b=F2XFn5lrfCRTMPh2xWDxDxLp51Fk8Hgawf6oTVHoc0/ovb9uCsTmvlTAVRuCkM4zy NfbPG36Ovkmd2D+FwQkinUjZx3x+WwE19CCyLQhMY5Ph1PnK/Q7OegRrQ/aACkKcen doZq3qotBHF+iFuapF5vR7BmvlugXJtQ68oHKIyt1t9fIqnoKbsXqyxgJw277OXXiS AZeLl9/ImIp/hYroHhaan4jACFnHhZnYAp82S/jg/E6KE/037HWX7ra06gnl1mpCG9 zRb6VRoiXIEoIjEP2/Nu7xUkVxpqWy10BbJ837LFsi+0ldXdx/UcOXX9b6FNbIVOgc GZy/hYW4HR1Ng== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4QBFnt09Hnz6tn4; Wed, 3 May 2023 13:58:09 +0200 (CEST) From: Ihor Radchenko To: numbchild@gmail.com Cc: Matt , emacs-orgmode@gnu.org Subject: Re: ob-shell sessions will send final echo '...' as input key sequence when previous command reads input interactively In-Reply-To: References: <87354hs9pz.fsf@localhost> <87mt2oqyup.fsf@localhost> <187de29d882.c92c2b661216812.7786590004610447376@excalamus.com> <878re5g0ir.fsf@localhost> Date: Wed, 03 May 2023 12:01:21 +0000 Message-ID: <87lei5aajy.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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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-Flow: FLOW_IN X-Migadu-Country: US ARC-Seal: i=1; s=key1; d=yhetil.org; t=1683115144; a=rsa-sha256; cv=none; b=el50Fd+9EVb/QaplYQqLdmCw3sYFowZ9mrLqA8mGAE7ETBbhKd6/xxe+0H/YYgB6O/mVp8 t3feN7QjilSEWd4bLKwswireUYDhufE6D+ZiNeSn3yucWHOUnDwBxI7lrmFX4RYoW4RP42 ZI/1RFiBRuBEAoRGFmGpztm78UmNSnEEBFSJ1dHVoKJOrv4RyNQdSYiGk+Kj2sXP17A4to nHCbTZ3Th8z1hCVNdT+6vaAxD++XpMjs+2dGEdB9kg7yollS2QEYIMsRXJLKze/PfsX7HH 4AShAW7Kx81yZXaVwzDzRh1/YRh5besDgqgVF0pjCgB5RGYzO3TiyMPRYDw4Nw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=F2XFn5lr; dmarc=pass (policy=none) header.from=posteo.net; 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1683115144; 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=YQSPp7tU9aUP9rxcOrgbJoKh15R9PHUUaujYwKfM9po=; b=br5RQu42e1o5o8RcX2KeWY5BQuwzhzDe+rbzrkaMpoa/fEoi6G+Hkr6+HvtCErCiGnMGT6 szxMRMvEZJ4dgeiABj+jZfixBLRYYRJuhvsTAwKozmgPg1JYldABR1JVawBaVVg6Mu8egY fZ9iAgK76M8wgGKkYpAsXY51J21v+nbzpxCqUCkgskLB+5K5ZVVbf338Lr87OkhYeyA4Tm JGYFMAhmoa4ZWLN3Q8pw4CPdOEppCJIwrRR/DQhyyCK0S0IMkw3QHMXD3yGkV2vJl5d6TL dMrGwHds0WoamFdNALgJm5W4/3zHoEYb3ZYDAllKc+bHMubYvbQvyzEhcriCLg== X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=F2XFn5lr; dmarc=pass (policy=none) header.from=posteo.net; 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" X-Migadu-Spam-Score: -6.19 X-Spam-Score: -6.19 X-Migadu-Queue-Id: 094802F929 X-TUID: wMdxVD/1Guxj "Christopher M. Miles" writes: > So currently ob-shell.el is async sending command into session buffer > without waiting for command to be finished. > > I checked out the ob-shell.el source code. I suppose this is the core > part of the problem. From intuitive view, session async evaluation > indeed should not wait for command to be finished. But still feel a > little weird. The core of the problem is in how Emacs comint is sending multiline input. My earlier example with M-x shell also demonstrates what is penning. comint.el basically simulates user input verbatim, as if you typed the whole thing symbol by symbol, including newlines. And it makes total sense as long as you are actually typing things interactively in the comint buffer. ob-shell :session in this case gets a bit weird. On one hand, it faithfully simulates interactive session. On the other hand, it does not feel fully interactive from user perspective, as you send a bunch of commands together within a single source block. One way to avoid the situations like with mpv could be packing the whole code block into script and then sending that script to comint session buffer. But then people who would like to actually switch to that buffer and work with it manually will get confused about what is going on there. (see `org-babel-switch-to-session' and `org-babel-switch-to-session-with-code'). > If this :stdin interesting idea works, maybe other similar ideas will too= .=F0=9F=99=8B > > For examples: > > - Wrap command "mpv" with a shell function which disable accepting intera= ctive input. Is there such a function? For all possible POSIX shells? > - Setting shell or environment variable in :prolog for source block to pr= eventing interactive input. Again, do you know how to do this? --=20 Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at