Morgan Smith <[email protected]> writes:

>> 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?

AFAIK, process-file automatically works with TRAMP.
I am not so sure about other approaches.

> 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.

We can try, I guess. I reviewed old threads involving process-file, and
it looks like it is using process-file that is creating all kinds of
subtle issues.

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

Reply via email to