简体   繁体   English

NSTask直到可可中的命令中断/ Objective-C

[英]NSTask Until Interrupted Command in Cocoa / Objective-C

I am trying to use NSTask on to run an ASR Multicast Stream, a Ruby Server Script, etc. Basically, I'm trying to run tasks with NSTask that do not finish running until interrupted, but the problem is that I can't get the NSTask to run in the background. 我正在尝试使用NSTask来运行ASR组播流,Ruby Server脚本等。基本上,我正在尝试使用NSTask运行直到被中断才能完成的任务,但是问题是我无法获取NSTask在后台运行。 So it ends up just running and holding up the rest of my program. 因此,它最终只是运行并保留了我程序的其余部分。 Any help? 有什么帮助吗?

Thanks! 谢谢!

NSTask shouldn't block your program unless you call the waitUntilExit method. 除非您调用waitUntilExit方法,否则NSTask不应阻止您的程序。 If you have to do that, you could make a new thread and start/wait for your NSTask from inside it. 如果必须这样做,则可以创建一个新线程,并从其中启动/等待NSTask As an alternative to blocking, you could look into NSTaskDidTerminateNotification . 作为阻止的替代方法,您可以查看NSTaskDidTerminateNotification The NSTask documentation covers all of these options. NSTask文档涵盖了所有这些选项。

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

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