简体   繁体   English

在苹果酒中打印执行输出

[英]print output of execution in cider repl

I am wondering if there is a way to have the output of the current execution in emacs cider when using cider-connect . 我想知道使用cider-connect时是否有一种方法可以在emacs cider中获得当前执行的输出。

For instance : 例如 :

  • I run lein repl on a project directory 我在项目目录上运行lein repl

  • then connect to it in emacs using cider-connect . 然后使用cider-connect在emacs中连接到它。

Now let's say that I have (println "cider is amazing by the way") in the code of one of my ring handlers, this will only be printed in the console I ran lein repl when a request is made. 现在,让我们说一下,我的其中一个铃声处理程序的代码中有(println "cider is amazing by the way") ,只有在发出请求时,它才会在我运行lein repl的控制台中打印。

How can I have this output also in my nrepl buffer ? 如何在nrepl缓冲区中也有此输出?

Sorry to say, I suspect that you cannot do this in the way you describe. 抱歉地说,我怀疑您无法按照自己的描述进行操作。 The output is going strait to the console of that device and not through anything related to nrepl on the way. 输出将直接进入该设备的控制台,而不会通过任何与nrepl相关的操作。 This also makes sense if you consider that nrepl is often not even running on the same computer. 如果您认为nrepl通常甚至不在同一台计算机上运行,​​这也很有意义。 (the "n" in nrepl is for "network"). (nrepl中的“ n”代表“网络”)。

Perhaps you can arrange for that output to be tee d to a file where you can get at it? 也许你可以安排为输出为tee d到一个文件,你可以得到它? Then you could start a thread on your nrepl buffer that cat ed that file. 然后,你就可以开始你的nrepl线程缓冲区cat编该文件。 Or have a buffer in emacs that watches the remote file. 或者在emacs中有一个监视远程文件的缓冲区。

If you start leiningen via cider-jack-in you should get the output in the repl buffer. 如果您是通过cider-jack-in杰克逊酒庄开始莱宁cider-jack-in那么您应该在repl缓冲区中获得输出。

One way to use this with a remote setup could be to call Cu Mx cider-jack-in and use a specialized server command that will essentially trigger the lein repl command (say over ssh) on the remote machine -- I haven't checked whether this will actually work, but I don't see any reason why it shouldn't. 将其用于远程设置的一种方法是调用Cu Mx cider-jack-in并使用专门的服务器命令,该命令本质上将触发远程计算机上的lein repl命令(例如通过ssh)-我尚未检查是否确实有效,但我看不出为什么不应该这样做。 If you can access the code over tramp, it shouldn't matter much whether the code is remote or not. 如果您可以通过流浪汉访问代码,则代码是否为远程都无关紧要。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM