• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSTask is intermittently failing to return results.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTask is intermittently failing to return results.


  • Subject: Re: NSTask is intermittently failing to return results.
  • From: "email@hidden" <email@hidden>
  • Date: Fri, 18 Mar 2011 21:36:53 +0000

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 (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSTask is intermittently failing to return results.
      • From: Jason Harris <email@hidden>
References: 
 >Re: NSTask is intermittently failing to return results. (From: Jason Harris <email@hidden>)

  • Prev by Date: Re: NSMatrix bindings
  • Next by Date: Re: NSTask is intermittently failing to return results.
  • Previous by thread: Re: NSTask is intermittently failing to return results.
  • Next by thread: Re: NSTask is intermittently failing to return results.
  • Index(es):
    • Date
    • Thread