在emacs中运行clojure测试时,使用leiningen和swank / slime停止无限循环 [英] Stopping infinite loops while running clojure tests in emacs with leiningen and swank/slime

查看:170
本文介绍了在emacs中运行clojure测试时,使用leiningen和swank / slime停止无限循环的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在某些类型的代码中,相对容易造成无限循环,而不会丢弃堆栈。当测试使用Clojure的测试这种性质的代码,有没有办法中止当前的运行测试,无需重新启动斯旺克服务器?

In certain kinds of code it's relatively easy to cause an infinite loop without blowing the stack. When testing code of this nature using clojure-test, is there a way to abort the current running tests without restarting the swank server?

目前我的工作流程已参与

Currently my workflow has involved

$ lein swank

连接与使用emacs 煤泥连接来斯旺克,并切换到测试,用执行抄送ç - ,测试运行直到死循环,然后只是返回,但是一个cpu仍然在测试。唯一的方法来阻止这一点,我发现是重新启动lein swank,但似乎这是一个相对普遍的问题?任何人有一个更好的解决方案?

Connect to swank with emacs using slime-connect, and switch to the the tests, execute with C-c C-,, tests run until infinite loop, then just return but one cpu is still churning away on the test. The only way to stop this I have found is to restart lein swank, but it seems like this would be a relatively common problem? Anyone have a better solution?

推荐答案

是的,这是程序员编写无限循环发展:)一个常见的问题。答案很简单。它被称为中断命令,它是 C-c C-b

Yes, it is a common problem for programmers to write infinite loops in development :). And the answer is very simple. It's called "Interrupt Command" and it is C-c C-b

Leiningen与这无关。这是SLIME / Swank / Clojure。当你在Emacs中评估代码时,你会在Clojure中产生一个新的线程。 SLIME保持对这些线程的引用,并显示有多少在Emacs modeline中运行。如果你在一个图形环境中,你可以单击模型行,它表示你的命名空间,看到很多选项。一个选项是中断命令

Leiningen has nothing to do with this. This is SLIME/Swank/Clojure. When you evaluate code in Emacs you are spawning a new thread within Clojure. SLIME keeps reference to those threads and shows you how many are running in the Emacs modeline. If you're in a graphical environment you can click the modeline where it indicates your namespace and see lots of options. One option is "Interrupt Command"

Eval (true) Cc Cb 得到一个对话框,显示一个 java.lang.ThreadDeath 错误,可能只有一个选项。您可以键入 0 q 退出该线程,终止该错误消息缓冲区并将焦点返回到上一个缓冲区。

Eval (while true) and C-c C-b to get a dialog showing a java.lang.ThreadDeath error with probably just one option. You can type 0 or q to quit that thread, kill that error message buffer and return focus to your previous buffer.

这篇关于在emacs中运行clojure测试时,使用leiningen和swank / slime停止无限循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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