Re: sharing file descriptors to an NSTask
Re: sharing file descriptors to an NSTask
- Subject: Re: sharing file descriptors to an NSTask
- From: Dave Keck <email@hidden>
- Date: Wed, 1 Sep 2010 01:33:02 -0400
Indeed NSTask closes open descriptors in the child. I could have sworn
this was documented somewhere, but I can't seem to find the relevant
text at the moment.
To get around this behavior (and other NSTask bugs and shortcomings),
I chose to write my own NSTask equivalent. Alternatively, you could
use sendmsg() and friends to share the descriptor with the child over
a Unix domain socket, but depending on what type of descriptor you'd
be sharing, that might defeat the purpose.
Off topic 1: The last I checked, the open-source Cocoa clones
(GNUstep, Cocotron) emulate this descriptor-closing functionality of
NSTask, which reinforces my belief that this was documented
somewhere...
Off topic 2: It's strange behavior in the first place, since AFAIK,
there's no efficient way of closing open descriptors short of for(i =
3; i < getdtablesize(); i++) close(i);
_______________________________________________
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