Capturing the output of “diff” with org-babel

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-13 08:22:28

问题


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

回答1:


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


来源:https://stackoverflow.com/questions/27304469/capturing-the-output-of-diff-with-org-babel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!