Eclipse可以轻松终止而不是使用SIGKILL吗? [英] Is it possible for Eclipse to terminate gently instead of using SIGKILL?

查看:142
本文介绍了Eclipse可以轻松终止而不是使用SIGKILL吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows上使用Eclipse,使用PyDev插件进行Python开发。当我使用'Run'启动我的应用程序时,它会产生一个新的Python(CPython)实例。当我使用终止按钮(红色方块)时,会杀死该进程。但是,它似乎做了一个SIGKILL,所以我的关机处理程序无法清理。



有没有办法让Eclipse发送SIGTERM或模拟键盘中断(ctrl-c)从Eclipse控制台?



注意:我知道还有其他Python IDE,如Komodo或Wing可能会解决这个问题,

解决方案

Eclipse使用发送信号的Java Process API。这是一个本机API,没有办法改变。我假设你也试图为SIGKILL安装一个处理程序,而且没有起作用。



因此,唯一的解决方案是写一个小批量文件,其中列出了进程并将SIGTERM发送给其中一个。从命令提示符调用。如果您使用Alt-Tab切换到它,它几乎和Eclipse内部一样舒适。



或者编写一个插件来调用批处理文件。

I'm using Eclipse on Windows, with the PyDev plugin for Python development. When I use 'Run' to start my application, it spawns a new Python (CPython) instance. When I use the 'terminate' button (red square), it kills the process. However, it appears to do a SIGKILL, so my shutdown handler is unable to clean up.

Is there any way to get Eclipse to send a SIGTERM, or simulate a keyboard interrupt (ctrl-c) from the Eclipse console?

Note: I'm aware there are other Python IDEs like Komodo or Wing that might solve this problem, but I'm not looking to switch over this.

解决方案

Eclipse uses the Java Process API which sends the signal. This is a native API and there is no way to change that. I assume that you've tried to install a handler for SIGKILL, too, and that didn't work.

Therefore, the only solution would be to write a small batch file which lists the processes and sends SIGTERM to one of them. Invoke that from a command prompt. If you use Alt-Tab to switch to it, it's almost as comfortable as doing it from inside Eclipse.

Or write a plugin to invoke batch files.

这篇关于Eclipse可以轻松终止而不是使用SIGKILL吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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