* Capturing the results of shell execution
@ 2017-01-17 15:05 Alex Bennée
2017-01-17 16:26 ` Michael Welle
0 siblings, 1 reply; 2+ messages in thread
From: Alex Bennée @ 2017-01-17 15:05 UTC (permalink / raw)
To: emacs-orgmode
I'm using org-babel snippets to automate some of my workflow. However
I'm not interested in dumping all of the compile output, I'd rather get
a simple value at the end to see if all was OK:
#+name: build-test
#+begin_src sh :results value
set -e
./configure --cross-prefix=aarch64-linux-gnu- --arch=arm64
make clean
make -j9
#+end_src
However there isn't a way to tell the difference between a failing
sequence and a passing one apart from *Org-Babel Error Output* being
popped up. It seems org-babel-eval just slurps up the return code and
blindly returns (buffer-string) regardless of the desires of the
:results keyword.
Is this an intentional limitation of babels sh evaluation?
Redirecting all the compile output in the snippet seems a little clumsy
a solution:
#+name: build-test
#+begin_src sh :results output
set -e
./configure --cross-prefix=aarch64-linux-gnu- --arch=arm64
make clean > /dev/null
make -j9 > /dev/null
echo "Build complete: `date`"
#+end_src
Ideally I'd like #+RESULTS to have a nice 0/1 which can be used to gate
other parts of the process.
Am I missing something?
--
Alex Bennée
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Capturing the results of shell execution
2017-01-17 15:05 Capturing the results of shell execution Alex Bennée
@ 2017-01-17 16:26 ` Michael Welle
0 siblings, 0 replies; 2+ messages in thread
From: Michael Welle @ 2017-01-17 16:26 UTC (permalink / raw)
To: emacs-orgmode
Hello,
Alex Bennée <alex.bennee@linaro.org> writes:
> I'm using org-babel snippets to automate some of my workflow. However
> I'm not interested in dumping all of the compile output, I'd rather get
> a simple value at the end to see if all was OK:
>
> #+name: build-test
> #+begin_src sh :results value
>
> set -e
> ./configure --cross-prefix=aarch64-linux-gnu- --arch=arm64
> make clean
> make -j9
> #+end_src
do it with shell?
#+begin_src sh :results output
(
set -e
echo "Build complete: `date`"
exit 1
) 2>&1 > /tmp/log
echo success: $?
#+end_src
Regards
hmw
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-01-17 16:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-17 15:05 Capturing the results of shell execution Alex Bennée
2017-01-17 16:26 ` Michael Welle
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).