views:

29

answers:

1

Hello,

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. So it ends up just running and holding up the rest of my program. Any help?

Thanks!

A: 

NSTask shouldn't block your program unless you call the waitUntilExit method. If you have to do that, you could make a new thread and start/wait for your NSTask from inside it. As an alternative to blocking, you could look into NSTaskDidTerminateNotification. The NSTask documentation covers all of these options.

Carl Norum
Well, I do all of the set up for the NSTask. I put a NSLog(@"BEFORE");, then I call [task launch];. Following that line, I put a simple NSLog(@"AFTER");. The BEFORE gets printed but not the AFTER.
hassaanm