如何从Cocoa应用程序内部终止进程(而非自身) [英] How to terminate a process (not self) from inside a Cocoa application

查看:82
本文介绍了如何从Cocoa应用程序内部终止进程(而非自身)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果Cocoa应用程序需要终止另一个进程(未生成),那么可以在10.5 OS X上使用哪些API来完成此操作?请注意,在Cocoa应用程序中将不知道要终止的进程的进程ID。需要终止的进程也是可可进程。

If a Cocoa application needs to terminate another process (which it did not spawn) what APIs can be used to do this on 10.5 OS X ? Please note that process ID of the process to be terminated will not be known inside the Cocoa application. The process which needs to be terminated is also a Cocoa process.

推荐答案

Iirc,NSWorkspace仅返回用户自己拥有的进程。但是,当然有很多不同的方法可以解决此问题:

Iirc, NSWorkspace will only return processes owned by the user itself, however, there are of course many different ways to take care of this:

1。)文档由Appple提供,QA1123

2。) AGKit中的AGProcess

这篇关于如何从Cocoa应用程序内部终止进程(而非自身)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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