Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Capturing the output of "diff" with org-babel

I'm trying to capture the output of diff with org-babel, but for some reason it's not working. For the files

1

a b c

2

a c b

diff 1 2 called from the command line returns

1c1
< a b c
---
> a c b

But with org-babel, nothing:

#+begin_src sh                                                                                                                                                 
diff 1 2                                                                                                                                                       
#+end_src                                                                                                                                                      

#+RESULTS:

The minibuffer reads "Code block produced no output". The org-babel error output window is empty. Other commands such as ls show the output as expected. I'm not familiar with org-babel.

I tried using :results output verbatim, no changes. I also tried using :results output replace as suggested here. Didn't help.

  • Emacs version is 24.4.1 (on Debian jessie)
  • Org-mode version is 8.2.10
like image 602
Alex Avatar asked Dec 04 '14 21:12

Alex


1 Answers

Looks like org-babel doesn't like it when the return code isn't 0. That's why the various solutions work. Adding another command uses means that the overall error code of the block is success. Similarly piping into cat makes the pipeline return the error code of cat. Yet another way of eating the error condition is:

  diff 1 2 || true
like image 71
seeker Avatar answered Nov 24 '22 01:11

seeker