• 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 oddity with getting stdout
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTask oddity with getting stdout


  • Subject: Re: NSTask oddity with getting stdout
  • From: Shane Stanley <email@hidden>
  • Date: Tue, 26 Jul 2011 16:18:17 +1000
  • Thread-topic: NSTask oddity with getting stdout

On 26/7/11 1:14 AM, "Scott Ribe" <email@hidden> wrote:

> On Jul 25, 2011, at 3:40 AM, Shane Stanley wrote:
>
>>> I wonder if they've changed how the readInBackgroundAndNotify works.
>>
>> Yes, they have. I logged a bug on it, and was told that the way it worked in
>> 10.6 was wrong -- whereas it used not to send a notification until there was
>> something to read, it now returns one immediately regardless. Whether that's
>> the problem here, I don't know.
>
> That's absolutely demented. If it sends a notification immediately, with or
> without data, then you're never really using it to read in the background,
> you're almost just spinning in a busy loop, getting a probably empty NSData,
> and calling readInBackgroundAndNotify again, as fast as the runloop can
> deliver the notifications.

Exactly. I built a sample app that did exactly that, and logged radar
#9120065. I was told that was correct behavior, and that "Snow Leopard's
NSFileHandle never correctly notified with a zero length data at EOF". The
suggested fix was "do a blocking -readDataOfLength: call on a background
thread".

--
Shane Stanley <email@hidden>
'AppleScriptObjC Explored' <www.macosxautomation.com/applescript/apps/>


_______________________________________________

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 oddity with getting stdout
      • From: Scott Ribe <email@hidden>
References: 
 >Re: NSTask oddity with getting stdout (From: Scott Ribe <email@hidden>)

  • Prev by Date: Re: App won't get to my code in Lion
  • Next by Date: Re: App won't get to my code in Lion
  • Previous by thread: Re: NSTask oddity with getting stdout
  • Next by thread: Re: NSTask oddity with getting stdout
  • Index(es):
    • Date
    • Thread