From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id 0AYBLWp9HGQnbAAASxT56A (envelope-from ) for ; Thu, 23 Mar 2023 17:25:14 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id mF/RLGp9HGTlsAAA9RJhRA (envelope-from ) for ; Thu, 23 Mar 2023 17:25:14 +0100 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 70EDC7198 for ; Thu, 23 Mar 2023 17:25:14 +0100 (CET) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=excalamus.com header.s=zmail header.b=Vh6vdBEv; arc=pass ("zohomail.com:s=zohoarc:i=1"); 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=none ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1679588714; 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=ATgfsDX7/8O7oAAWMr1BqAYI+bi6gdb0+Rgv8vGIuwc=; b=BQqaIvT5h1KWBjVd36PpFfAb7fLrokoYGlATegw3Kl10hQbKviGGqRihkvkfQ5xPOrJIxa JY61mDeEVVK8dEK87zBUI/T/iYuU4BKWiMGpcKmX1QLn8qbbs9M1H9gR34Fun2bb3bATWf 41Trv2OMMRF5+7N3GV0MCXgK4P0P8PgLjfdOtC3TClKiy0f1ZLAKhCoUaL238x1ps2ttJc Cadkbb2A8bCQaOXQrIoSWdS2fcZXnbQnOyDNMNnZmVWQUxShWtoMtBvvTC/xvMWn8VD9ce prSJQTWUQV2hd+cQ+I6WrJwxTNQn/ADqhMXhI+FPjFOZ/xsObT72KMDInI4n2g== ARC-Seal: i=2; s=key1; d=yhetil.org; t=1679588714; a=rsa-sha256; cv=pass; b=fX8nsI6hjLXakh0tkY3J0tbkcu4bdy8Rwjz2BDh4rWmK751qB5FjvUCbnfwVkinHzTF5/1 XwFKRz0auLBe0C5mbAK1RNrVWoLmJlunnjLq4fVLicrqSOzluhBco/EbNYVmIy8lf9L3px AV0bSNVLSH/WxHiDONzhItVc0HC3u9vnaF9usnyuECKVs1Xmzl+Ch3iXrwsr6s2GosuBzF VzF7Z44Qmdukyc3175rd3DuAoT6/vzD+0KA86ePP1/jpAIgDtQEj1o/buGY1Rk7Z/YYigU p7Jo7PNLnR60F186z60bNfox1TcWrPfknnQzpwdnyfg/rBr70hO6NKCBFurv+w== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=pass header.d=excalamus.com header.s=zmail header.b=Vh6vdBEv; arc=pass ("zohomail.com:s=zohoarc:i=1"); 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=none Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pfNjn-00031n-GZ; Thu, 23 Mar 2023 12:24:27 -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 1pfNjl-00031K-8p for emacs-orgmode@gnu.org; Thu, 23 Mar 2023 12:24:25 -0400 Received: from sender4-op-o15.zoho.com ([136.143.188.15]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pfNjj-0001TN-GL for emacs-orgmode@gnu.org; Thu, 23 Mar 2023 12:24:25 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1679588631; cv=none; d=zohomail.com; s=zohoarc; b=URU9Ji2cX7hFkWkriWoE5IAI/d0nBq0MjHyujJOLuse+A1yJliY8kwI8m99/Gt85vsaGN+YSbkzzZ6ze2gjxITB6DgrC2j4z50xy481atGFMPXz+x6KZ3ms9LhqcAUwvXYX+Eg7R4ZzZq+snUFIAIID3R/utjsp0AFDpHAoxcPU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1679588631; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=ATgfsDX7/8O7oAAWMr1BqAYI+bi6gdb0+Rgv8vGIuwc=; b=Byg4u+To0k7SBhciM04LtTgchDnYW79gZEnG7qaqpe0fUlj1IKHNdKj4J/eAWqayQWGm7dXTOxZpSHAYFtSGDra5IL2MvLqNQC03D+r7f+DI6GLGu2FIU5pdQmMQqSnOe4OE6GPUWkI4qJSP/Z6UaWmTH6bCT3YpWtJ+TCNPLZ4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=excalamus.com; spf=pass smtp.mailfrom=matt@excalamus.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1679588631; s=zmail; d=excalamus.com; i=matt@excalamus.com; h=Date:Date:From:From:To:To:Cc:Cc:Message-ID:In-Reply-To:References:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To; bh=ATgfsDX7/8O7oAAWMr1BqAYI+bi6gdb0+Rgv8vGIuwc=; b=Vh6vdBEv9TH9ahsybvkCP8JM/dq+AlbCYxj212CDNYknt/AiC1bg0v0hHBnN3jGP 0YI/UM6ha7HmOyrW3rIhJHJHdz3IBuDJ6dmH89CfOQ9J/W6JCt4ntCwclQk1G4oE38g eZlmfG62Xlyj6rrX3tWOBsn2QsnnLT6i/4lxttlE= Received: from mail.zoho.com by mx.zohomail.com with SMTP id 1679588630250348.4831650601967; Thu, 23 Mar 2023 09:23:50 -0700 (PDT) Date: Thu, 23 Mar 2023 12:23:50 -0400 From: Matt To: "numbchild" Cc: "Ihor Radchenko" , "emacs-orgmode" Message-ID: <1870f489edc.f5692336744686.2501966448088129374@excalamus.com> In-Reply-To: References: <186283d230a.129f5feb61660123.3289004102603503414@excalamus.com> <87v8kd8zzw.fsf@localhost> <1863472efe9.10fdd5ba4258906.5972264927968042941@excalamus.com> <87y1p7axpe.fsf@localhost> <1870cb30c41.ba75a358545366.6275787333945468963@excalamus.com> Subject: Re: [SUGGESTION] ob-shell async result output should not contains shell prompt MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Importance: Medium User-Agent: Zoho Mail X-Mailer: Zoho Mail Received-SPF: pass client-ip=136.143.188.15; envelope-from=matt@excalamus.com; helo=sender4-op-o15.zoho.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, 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: X-Migadu-Queue-Id: 70EDC7198 X-Spam-Score: -8.54 X-Migadu-Spam-Score: -8.54 X-Migadu-Scanner: scn0.migadu.com 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-TUID: TQldIjlIDPiD ---- On Thu, 23 Mar 2023 07:12:29 -0400 Christopher M. Miles wrote --- > #+begin_src bash :session "*ob-shell-bash*" :async t > sleep 30 > echo "hello, world" > #+end_src > > #+RESULTS[(2023-03-23 19:14:15) 23f9ad130f7a1268e21821c6baaea2b057c70d3e]: > : org_babel_sh_prompt> hello, world > > Still got a prompt. Is this intended? I think the output should be kept clean because the result > output might be used as input for other source blocks as data. I absolutely agree. This is a bug. It should be an easy fix on my end but, in case there are details I'm overlooking, this specific example can use the following workaround: #+begin_src bash :session "*ob-shell-bash*" :async t sleep 30 && echo "hello, world" #+end_src To explain what's going on... #+begin_longwinded_explanation Shell output is filtered for prompts which should be removed before inserting the results. The issue is that the filter assumes the prompt starts at the beginning of the line. When sleep is called, it returns nothing and the next prompt appears on the same line: sh-5.1$ PROMPT_COMMAND=;PS1="org_babel_sh_prompt> ";PS2= org_babel_sh_prompt> echo 'ob_comint_async_shell_start_770d9c8f-deda-4359-aee9-a433a75a5e0d' echo "1" sleep 3 echo "2" echo 'ob_comint_async_shell_end_770d9c8f-deda-4359-aee9-a433a75a5e0d' ob_comint_async_shell_start_770d9c8f-deda-4359-aee9-a433a75a5e0d org_babel_sh_prompt> 1 org_babel_sh_prompt> org_babel_sh_prompt> 2 org_babel_sh_prompt> ob_comint_async_shell_end_770d9c8f-deda-4359-aee9-a433a75a5e0d Changing the `ob-shell-async-chunk-callback' like this will fix it: @@ -276,7 +276,7 @@ See `org-babel-comint-async-indicator'.") (defun ob-shell-async-chunk-callback (string) "Filter applied to results before insertion. See `org-babel-comint-async-chunk-callback'." - (replace-regexp-in-string comint-prompt-regexp "" string)) + (replace-regexp-in-string (concat (regexp-quote org-babel-sh-prompt) " *") "" string)) (defun org-babel-sh-evaluate (session body &optional params stdin cmdline) "Pass BODY to the Shell process in BUFFER. #+end_longwinded_explanation