On 18 Mar 2011, at 21:04, Jason Harris wrote: > > > Hi Jonathan, > > Thanks for looking at this! It's good to know I am not going crazy and there > is some subtle thing I am doing wrong here... > > Just to clarify you mean this example here: > > http://developer.apple.com/library/mac/#samplecode/CommandLineTool/Listings/CommandLineToolPlugIn_m.html > > for the CommandLineToolPlugin.m? Yep.
> > I hadn't seen this approach at the end of using [task waitUntilExit] after > you have set up the observers and notifications. I had seen in eg > OpenFileKiller: > http://cocoawithlove.com/2009/05/invoking-other-processes-in-cocoa.html and > in https://bitbucket.org/snej/myutilities/src/tip/MYTask.m where a run loop > is used. Ie something like: > > - (void)launchTaskAndRunSynchronous > { > [task launch]; > > BOOL isRunning = YES; > while (isRunning && (!taskComplete || !outputClosed || !errorClosed)) > { > isRunning = > [[NSRunLoop currentRunLoop] > runMode:NSDefaultRunLoopMode > beforeDate:[NSDate distantFuture]]; > } > } > I don't see any reason not to use the NSTask implementation unless you encounter any particular issues. > (Also just glancing at the code, I noticed a couple of really small things... > the date at the top of CommandLineToolPlugin.m lists 2009 yet its using old > style NS_DURING, NS_HANDLER, NS_ENDHANDLER which seems a little strange... > but its not wrong or anything, just a little well strange. Yes, a bit curious. Maybe its a rehash of something more archaic though the revision notes don't specify this. Regards Jonathan Mitchell Developer Mugginsoft LLP http://www.mugginsoft.com _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com