• 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 troubles
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTask troubles


  • Subject: Re: NSTask troubles
  • From: Alastair Houghton <email@hidden>
  • Date: Fri, 13 Jul 2007 00:16:26 +0100

On 13 Jul 2007, at 00:04, John Stiles wrote:

Well, I think I understand what you're saying here—atos' output is queued up and not being sent back to me—but do you know how to work around the issue? Reading the docs, I only see two semi-promising approaches: do an fsync on the file descriptor, or call - synchronizeFile on the pipe's NSFileHandle.

I'll try these, but I'm still not sure why this would work fine on Intel…

It probably isn't the pipe buffer that's causing you trouble here.

If the problem is the output buffering in the C runtime (which I think you'll find it is), then neither of those will solve it. There are three fixes that will work:

1. Change your program to follow the pseudo-code I wrote. That's how we solved the same problem here.

2. Change your program to use a pseudo-tty rather than a pipe.

3. Change atos itself so that it either (a) doesn't use output buffering or (b) does an explicit fflush() after printing each result.

Plainly option 3 is not practical. Option 1 is fairly straightforward and works fine for atos; option 2 is a bit trickier, but is a more general way to let your program drive software that exhibits "interactive" behaviour.

Kind regards,

Alastair.

--
http://alastairs-place.net




_______________________________________________

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 troubles
      • From: Timothy Klein <email@hidden>
    • Re: NSTask troubles
      • From: John Stiles <email@hidden>
References: 
 >NSTask troubles (From: John Stiles <email@hidden>)
 >Re: NSTask troubles (From: Alastair Houghton <email@hidden>)
 >Re: NSTask troubles (From: John Stiles <email@hidden>)

  • Prev by Date: Re: controlTextDidChange does not respond
  • Next by Date: Re: Sharing a Framework between multiple applications
  • Previous by thread: Re: NSTask troubles
  • Next by thread: Re: NSTask troubles
  • Index(es):
    • Date
    • Thread