Wizard
Wizard

Reputation: 22113

Redirect error in Org Babel's src to the results

Org's babel could export the stdtout to results

#+BEGIN_SRC shell
echo "testing "
#+END_SRC

#+RESULTS:
: testing

and report error to a new buffer or mini-buffer

#+BEGIN_SRC shell
e 
#+END_SRC

#+RESULTS:

the error appear in a new buffer

/bin/bash: line 1: e: command not found

How could redirect the error to a #+RESULTS?

Upvotes: 1

Views: 130

Answers (1)

adl
adl

Reputation: 16054

You could redirect stderr to stdout.

#+BEGIN_SRC sh :prologue exec 2>&1
  e
#+END_SRC 

#+RESULTS:
: sh: 2: e: not found

You may also want to add :epilogue true to suppress the [ Babel evaluation exited with code 127 ] that may appear.

Upvotes: 0

Related Questions