emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bash source code block: problem after ssh commands


From: Ihor Radchenko
Subject: Re: bash source code block: problem after ssh commands
Date: Thu, 09 Nov 2023 12:14:59 +0000

Matt <matt@excalamus.com> writes:

> ... Aside from permission, any code we
> insert needs to be correct. For example, a shebang would need to point
> to the correct application and any arguments would need to correspond
> to the implementation being called. I doubt we'd need anything beyond
> /bin/<shell>. FWIW, it looks like there's been at least one instance
> where :shebang's formatting was questioned
> (https://yhetil.org/orgmode/CA+A2iZZ1vMmKiUf4Fem1AU7CA1m9GQap+BkvrOsz+0BxRt6rRA@mail.gmail.com/).

It is a problem, but I am not sure how useful it is to solve the line
numbering there. A bigger problem is that errors *Org Babel Error
Output* are not clickable:

Try
#+begin_src bash
cdf
#+end_src
and you will get
------ *Org Babel Error Output* ---------
bash: line 1: cdf: command not found
[ Babel evaluation exited with code 127 ]
-----------------------------------------

Clicking on "line 1" will yield file opening dialogue.

However, there is yet another problem revealed when we try

#+begin_src bash :cmdline bash
cdf
#+end_src

#+RESULTS:
: /tmp/babel-47DarV/sh-script-vkbRfJ: line 2: cdf: command not found

There is no *Org Babel Error Output* buffer at all.

So, it looks like we may need an alternative `org-babel-eval' function
that works with script files rather than input and arranges
stdout/stderr separation.

> We'd also need to control for what environment the script runs in.
> That was another issue I saw raised in the list
> (https://yhetil.org/orgmode/87609ug5ae.fsf@luisa.c0t0d0s0.de/). Of
> course, we'd need to read the stdout and stderr. This is handled by
> =process-file=. Any step I missed or some kind of failure I didn't
> consider?

Valid concern. We should reuse `process-file' in this scenario as well,
but utilizing its ARGS argument + arrange to generate the temporary
script file in the appropriate context - see `make-nearby-temp-file'.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
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

[Prev in Thread] Current Thread [Next in Thread]