Ihor Radchenko <[email protected]> writes:
> Morgan Smith <[email protected]> writes:
>
>> The branch for dealing with "shebang" gets the shell path by calling
>> `org-babel--get-shell-file-name'. Guix patches that function to point
>> to the right shell when they package org-mode. Although looking at the
>> logic now I can see that guix is very much in the wrong for doing that.
>> Oh dear. I'm going to have go tell them to stop doing that.
>>
>> Regardless I think the refactor might be good? I'm really not good with
>> tramp
>> so I'm not sure. Feel free to skip this patch if you don't like it. We can
>> come back to it at a later date.
>
> I am not sure.
> There are subtle differences between piping the script into shell, and
> running shell command with script file as an argument. So, I fear that
> we may introduce bugs. The whole ob-shell.el may be prefixed with "there
> be dragons" honestly.
>
Who is piping a script into a shell?
The code I'm removing puts everything in a shell script and then runs it
as an argument. I'm replacing it with `(org-babel-eval script-file)'
which also runs it as an argument.
So instead of running this in `org-babel-sh-evaluate'
#+BEGIN_SRC elisp
(apply #'process-file
shell-file-name
stdin-file
(current-buffer)
nil
(list shell-command-switch
(concat (file-local-name script-file)
" "
(format "%s" cmdline))))
#+END_SRC
We end up running this in `org-babel--shell-command-on-region' (where
command is the script-file)
#+begin_src elisp
(process-file
shell-file-name input-file
(if error-file
(list t error-file)
t)
nil shell-command-switch command)
#+end_src
This is not to say I am confident that this will act similar to the
previous thingy. I very much agree with the "there be dragons" and I
don't really understand everything.