Re: NSTask troubles
Re: NSTask troubles
- Subject: Re: NSTask troubles
- From: John Stiles <email@hidden>
- Date: Thu, 12 Jul 2007 16:29:17 -0700
On Jul 12, 2007, at 4:16 PM, Alastair Houghton wrote:
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.
Well, with Option 1, if I close the write site of the pipe, can I
reopen it later? If not, then I'd have to close the atos session and
begin a new one, which isn't really a good choice for us since each
new instantiation takes a looooong time for our current app. (About
60 seconds, no joke.) This is for a graphical debugger tool and we
may be showing many different stack crawls as the user navigates the UI.
For option 2, this is unfamiliar territory for me, so do you know
where I could find any sort of example code? (I'll Google around as
well)_______________________________________________
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