emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: emacs-orgmode@gnu.org
Subject: Capturing the results of shell execution
Date: Tue, 17 Jan 2017 15:05:29 +0000	[thread overview]
Message-ID: <87vatdu3pi.fsf@linaro.org> (raw)


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

             reply	other threads:[~2017-01-17 15:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-17 15:05 Alex Bennée [this message]
2017-01-17 16:26 ` Capturing the results of shell execution Michael Welle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87vatdu3pi.fsf@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).