捕获“ diff”输出,以获取“ diff”。与org-babel [英] Capturing the output of "diff" with org-babel

查看:107
本文介绍了捕获“ diff”输出,以获取“ diff”。与org-babel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用org-babel捕获 diff 的输出,但是由于某些原因,它无法正常工作。对于文件



1

  abc 

2

  acb 

diff 1 2 从命令行返回

  1c1 
< a b c
---
> acb

但是对于org-babel,什么也没有:

 #+ begin_src sh 
diff 1 2
#+ end_src

#+结果:

小型缓冲区读取代码块未产生输出。 org-babel错误输出窗口为空。其他命令,例如 ls 显示预期的输出。我不熟悉org-babel。



我尝试使用:结果逐字输出,没有任何变化。我还尝试使用:results output replace 作为建议的此处。没帮助。




  • Emacs版本是24.4.1(在Debian jessie上)

  • Org -mode版本是8.2.10


解决方案

我可以在OSX上重现您的问题。



奇怪的是,执行babel块会打开 Org-babel错误输出缓冲区,就像有些东西要进入STDERR。 / p>

如果在diff后添加任何其他输出,结果将显示OK。例如,

 #+ begin_src sh:结果输出
diff 1 2
echo
#+ end_src

如果您将diff的结果强制为标准输出,结果还将显示:

 #+ begin_src sh:结果输出
diff 1 2 |猫
#+ end_src


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

解决方案

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

这篇关于捕获“ diff”输出,以获取“ diff”。与org-babel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆