On 23-Jun-10, at 9:35 AM, Alastair Houghton wrote:
On 23 Jun 2010, at 11:14, Ben Haller wrote:
3. I added [[pipe fileHandleForWriting] closeFile] and [[pipe
fileHandleForReading] closeFile] calls to close the files
associated with the pipes when my tasks completed. This change
fixed the problem; I no longer run out of file descriptors.
Are you making the classic NSTask mistake of doing [pipe
fileHandleForReading] or [pipe fileHandleForWriting] and then using
that with -setStandardOutput: or -setStandardInput:?
NSTask is odd in this respect, in that you're supposed to just pass
the *NSPipe*, not a file handle derived from it. If you do the
latter, IIRC (from the last time I did this, which was ages ago) it
may indeed leak file descriptors.
You only need an NSFileHandle where your process is going to
actually read or write; they aren't used for passing pipe handles to
subprocesses.
A good clarification, but I was already passing the pipes to NSTask.
Ben Haller
McGill University
_______________________________________________
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