Capturing the output of "diff" with org-babel

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

I could reproduce your problem (on OSX).

The strange thing is that executing the babel block will open the Org-babel Error Output buffer, as if something were going to STDERR.

If you add any other output after diff, results will display OK. For example,

#+begin_src sh :results output
diff 1 2
echo
#+end_src

If you force diff's results to stdout, results will also display:

#+begin_src sh :results output
diff 1 2 | cat
#+end_src