发送SIGINT(Ctrl-C)到在Eclipse控制台中运行的程序 [英] Sending SIGINT (Ctrl-C) to program running in Eclipse Console

查看:381
本文介绍了发送SIGINT(Ctrl-C)到在Eclipse控制台中运行的程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在Eclipse中设置了运行配置,需要向程序发送SIGINT(Ctrl-C)。在SIGINT之后运行的程序中有清理代码,所以按下Eclipse的终止按钮将不起作用(他们发送SIGKILL我想)。在控制台中键入CTRL-C也不起作用。



如何将SIGINT发送到Eclipse控制台中运行的进程?



(FWIW我正在运行一个Twisted守护进程,需要Twisted才能正确关闭,只发生在SIGINT上)

解决方案

如果您可以使用诸如ps的实用程序来确定进程,则可以使用kill将其发送给SIGINT。该程序可能是eclipse的子进程。

  kill -s INT< pid> 


I have setup a run configuration in Eclipse and need to send SIGINT (Ctrl-C) to the program. There is cleanup code in the program that runs after SIGINT, so pressing Eclipse's "Terminate" buttons won't work (they send SIGKILL I think). Typing CTRL-C into the Console also doesn't work.

How do I send SIGINT to a process running inside an Eclipse Console?

(FWIW I am running a Twisted daemon and need Twisted to shutdown correctly, which only occurs on SIGINT)

解决方案

If you can determine the process with a utility such as ps, you can use kill to send it a SIGINT. The program will likely be a child process of eclipse.

kill -s INT <pid>

这篇关于发送SIGINT(Ctrl-C)到在Eclipse控制台中运行的程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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