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 (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com