From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id cNhIAI3ExWPciwAAbAwnHQ (envelope-from ) for ; Mon, 16 Jan 2023 22:41:33 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id YFJDAI3ExWNz2gAA9RJhRA (envelope-from ) for ; Mon, 16 Jan 2023 22:41:33 +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 AB38D39367 for ; Mon, 16 Jan 2023 22:41:31 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pHXDa-0001ir-GI; Mon, 16 Jan 2023 16:40:38 -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 1pHXDZ-0001ig-3g for emacs-orgmode@gnu.org; Mon, 16 Jan 2023 16:40:37 -0500 Received: from sender4-op-o12.zoho.com ([136.143.188.12]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pHXDW-0000qB-TE for emacs-orgmode@gnu.org; Mon, 16 Jan 2023 16:40:36 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1673905228; cv=none; d=zohomail.com; s=zohoarc; b=feet6mdNS5tol4OXuncufRYEUFQTApXw1kLg6gmkHukiCBNNZgNPV+weDtY8yPC2/v/JMBuGldbcpjBx1hK+mmw5d54mxKluJTJYBgU44pWC1v4uDzbU/aXQn0CpUzXer6O/2JcV/89Hj/3W5fDdyNjZAHW+/+UzGBt4+o7xhQc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673905228; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=hvj/epTlPVTaBZzM3JKrOG4lDxhxAx949UcODC2cqOA=; b=azEh5JpZ+7mjKSmOBx9jVD+5g9PTf6wetyFC9RCKS/HZwpdRzeI3v7Tsri5rUereRvfa94L6cWbcO1bxpVR8O6c4gp3Q/OsFycrFbXERE4aBx2p3TE21ki1q7TQlIReg+OgAJsxTbum33UTN939iZuS4FnayQJ2LkI6ucEhQPzE= 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=1673905228; 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=hvj/epTlPVTaBZzM3JKrOG4lDxhxAx949UcODC2cqOA=; b=eGGP6+I/rrNI25g4KpjMmVo1n7CYncas+XPplZ4ZRjrkcwMOOZkGyKuKIU/VBqe4 U6rs/9+hV8ZDRDb4jj3I0AmjrePHU6H78i804Op43FvoAV1q5thw1OFlqyMzH9AjSjX qwhlZtnY+YJXhE+/GSxJs7IrsR1c5QTp90zxLaB0= Received: from mail.zoho.com by mx.zohomail.com with SMTP id 16739052278311005.2384625617096; Mon, 16 Jan 2023 13:40:27 -0800 (PST) Date: Mon, 16 Jan 2023 16:40:27 -0500 From: Matt To: "Osher Jacob" Cc: "emacs-orgmode" Message-ID: <185bc86c826.11ae860d1190626.407710511075709301@excalamus.com> In-Reply-To: References: Subject: Re: [BUG] ob-shell doesn't evaluate last line on Windows (cmd/cmdproxy) [9.6.1 ( @ c:/Users/Osher/AppData/Roaming/.emacs.d/elpa/org-9.6.1/)] MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Importance: Medium User-Agent: Zoho Mail X-Mailer: Zoho Mail Received-SPF: pass client-ip=136.143.188.12; envelope-from=matt@excalamus.com; helo=sender4-op-o12.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, RCVD_IN_MSPIKE_H2=-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 ARC-Seal: i=2; s=key1; d=yhetil.org; t=1673905291; a=rsa-sha256; cv=pass; b=Gp04T7d7T95+9s0pYPlD3ermnPasfZt3e+bTqBjpbraMh8fEUiwMUcrLcUbFu5Oq6z5lGi KoKqzVIpKEOFj2TbrPUEJI5LzBAItwEkptD+YtNemObXa/QjJ+aB4r8Ykv5nlc/rscJ799 6dx2o9Mshefasa7oFImdwUku2wKTr5PjOgguQEEaZ9oMC2HMZ+ib2z+dOUf5EHJfm3b1yE s9p4tVtNeGrJk5HABrNtEvrU8zeGAZ1mgT8xlBF03SgBQvJ4KGhxoQnHW5oV0bBD8vvbql dOy0AFDNmlcvRwbh2PPoff391R/AQq3Y20rmJnZP9i/ARTA89eO0mt+6U4IOig== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=pass header.d=excalamus.com header.s=zmail header.b="eGGP6+I/"; 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=pass ("zohomail.com:s=zohoarc:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1673905291; 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=hvj/epTlPVTaBZzM3JKrOG4lDxhxAx949UcODC2cqOA=; b=HI/ws+obWKvIfzHs90QRCbITRQchMxAVQNBGJiH9PlgGzHxRdEuyj1mnc3c1dEc7cK4DZa 5N5maWrDyWP5XZb2eRICDJ26Clo+BZm89WDPbZhWFhD9FFR3cjBtav6rGtUcHrNbOa9Rly qjaU+G74OxBE4xh8m9nofVFwBy6hTPDx+WMALFvjfJlaghPRx9u99NNaU5m8hZKZcklZoa uki8dHDk4Q8GTn540V9ItpHQIw/AFfXqWWgyCTUEyONe2VmlDbhQ+EAVMY3xdJlJYWWJut jGBQ2Tcly8akZ4HVmIu+67+cv/1vmpmwzjASdlOZvtYcMe6J0WWwoaB+fOs5Vg== X-Migadu-Spam-Score: -5.31 X-Spam-Score: -5.31 X-Migadu-Queue-Id: AB38D39367 X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=excalamus.com header.s=zmail header.b="eGGP6+I/"; 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=pass ("zohomail.com:s=zohoarc:i=1") X-TUID: nt+NK+NIRIV3 Thank you for your report, Osher! Windows shells aren't currently supported by ob-shell, AFAIK. I'm open to = including them. Unfortunately, I don't have a Windows machine to test agai= nst. =20 ---- On Mon, 16 Jan 2023 11:27:52 -0500 Osher Jacob wrote ---=20 > Expected behaviour: > On Windows, all lines of the babel shell block should be evaluated, with= full output printed. What's does `C-h v shell-file-name' say? That should tell us what shell is= being used. > #+begin_src shell > echo 1 > echo 2 > > > #+end_src > > #+RESULTS: > | Microsoft =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | Windows =C2=A0 |= [Version =C2=A0 =C2=A0 | 10.0.19044.2364] | =C2=A0 =C2=A0 =C2=A0 =C2=A0| = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | > | (c) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | M= icrosoft | Corporation. | All =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0| rights | reserved. | > | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0| =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0| =C2=A0 =C2=A0 =C2=A0 =C2=A0| =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= | > | c:\Users\osherj>echo =C2=A0| 1 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| =C2=A0 =C2=A0 =C2=A0 =C2=A0| =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 | > | 1 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0| =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0| =C2=A0 =C2=A0 =C2=A0 =C2=A0| =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | > | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0| =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0| =C2=A0 =C2=A0 =C2=A0 =C2=A0| =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= | > | c:\Users\osherj>More? | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| =C2=A0 =C2=A0 =C2=A0 =C2=A0| =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 | >=20 > The hacky way I solved it was to change this line: > (t (org-babel-eval shell-file-name (org-trim body)))))) > to this: > (t (org-babel-eval shell-file-name (concat (org-trim body) "\n")))))) I don't think org-trim is the issue. Running the block (eventually) calls the default shell command, `org-babel-= -shell-command-on-region'. This calls `org-babel--get-shell-file-name' on = a temp file containing the block source using the "-c" flag. I assume the shell used is cmdproxy.exe (https://git.savannah.gnu.org/cgit/= emacs.git/tree/nt/cmdproxy.c). It looks like this converts a "-c" to a "/= c", among other things. MSDN says for cmd.exe, Parameter =09Description /c =09Carries out the command specified by string and then stops. /k =09Carries out the command specified by string and continues. So, the way I reason it, ob-shell tries calling cmdproxy.exe using /c which= basically calls cmd.exe /c, the block temp file is executed, and the shell= stops. I see that `org-babel--shell-command-on-region' calls `process-file' using = the `shell-command-switch'. It doesn't appear to be set anywhere else in `= ob-eval' (see ob-eval:112). > Let me know if there's any other information you need, or if I can help i= n any other way. I wonder if changing `shell-command-switch' to "/k" would make a difference= ? =20 That is, go through the steps to reproduce and before executing the block, = run `M-: (setq shell-command-switch "/k")'.