Re: NSTask oddity with getting stdout
Re: NSTask oddity with getting stdout
- Subject: Re: NSTask oddity with getting stdout
- From: Scott Ribe <email@hidden>
- Date: Mon, 25 Jul 2011 07:45:22 -0600
On Jul 24, 2011, at 11:01 PM, Stephen J. Butler wrote:
> That is, abandon processPipeClose and let each pipe handle its own
> close in the notification when you're sure all of its read
> notifications have actually been delivered. As you've presented it,
> processPipeClose isn't needed.
Your theory makes sense to me, and I think for now I'll assume it's the explanation for the behavior.
In the real code there's things I need to do after receipt of complete output from both pipes; I just stripped that out of processPipeClose to make this easier to read. However, I can still incorporate your suggestion, and just do the "after everything" processing when the second of curStdOut & curStdErr go to nil.
If I weren't feeling lazy this morning, I would dig back through version control. I think the code some time ago was more similar to your suggestion, but loaded up with some unnecessary complications, and this race condition is a result of a simplification attempt which I did not get quite right.
Thanks a lot. This was, IMO, not a trivial question ;-)
--
Scott Ribe
email@hidden
http://www.elevated-dev.com/
(303) 722-0567 voice
_______________________________________________
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