[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [BUG] ob-shell doesn't evaluate last line on Windows (cmd/cmdproxy)
From: |
Matt |
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/)] |
Date: |
Mon, 16 Jan 2023 16:40:27 -0500 |
User-agent: |
Zoho Mail |
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 against.
---- On Mon, 16 Jan 2023 11:27:52 -0500 Osher Jacob wrote ---
> 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 | Windows | [Version | 10.0.19044.2364] |
> | |
> | (c) | Microsoft | Corporation. | All |
> rights | reserved. |
> | | | | |
> | |
> | c:\Users\osherj>echo | 1 | | |
> | |
> | 1 | | | |
> | |
> | | | | |
> | |
> | c:\Users\osherj>More? | | | |
> | |
>
> 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 Description
/c Carries out the command specified by string and then stops.
/k Carries 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 in
> any other way.
I wonder if changing `shell-command-switch' to "/k" would make a difference?
That is, go through the steps to reproduce and before executing the block, run
`M-: (setq shell-command-switch "/k")'.
- [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/)], Osher Jacob, 2023/01/16
- 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/)],
Matt <=
- 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/)], Matt, 2023/01/16
- 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/)], Osher Jacob, 2023/01/17
- 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/)], Matt, 2023/01/18
- 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/)], Ihor Radchenko, 2023/01/18
- 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/)], Osher Jacob, 2023/01/19
- 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/)], Matt, 2023/01/19
- 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/)], Ihor Radchenko, 2023/01/20
- 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/)], Matt, 2023/01/22
- 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/)], Ihor Radchenko, 2023/01/23
- 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/)], Matt, 2023/01/25