0

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!

Charles
  • 50,943
  • 13
  • 104
  • 142
hassaanm
  • 14,539
  • 4
  • 21
  • 20

1 Answers1

0

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
  • 219,201
  • 40
  • 422
  • 469
  • 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 Jul 09 '10 at 17:43