Re: NSFileHandleReadCompletionNotification and/or NSTaskDidTerminateNotification?
Re: NSFileHandleReadCompletionNotification and/or NSTaskDidTerminateNotification?
- Subject: Re: NSFileHandleReadCompletionNotification and/or NSTaskDidTerminateNotification?
- From: "Shawn Erickson" <email@hidden>
- Date: Thu, 15 Jun 2006 09:09:23 -0700
On 6/15/06, Herman Steve <email@hidden> wrote:
NSTaskDidTerminateNotification
Don't bother with the above for this type of thing.
NSFileHandleReadCompletionNotification
The docs for -[NSFileHandle readInBackgroundAndNotify] point out that
it uses availableData and then posts the results via the
NSFileHandleReadCompletionNotification notification. The docs for
availableData states...
"If the receiver is a file, returns the data obtained by reading the
file from the file pointer to the end of the file. If the receiver is
a communications channel, reads up to a buffer of data and returns it;
if no data is available, the method blocks. Returns an empty data
object if the end of file is reached."
So if you get an empty NSData you are at the end of file and in the
case of a pipe it means that the pipe has been closed (which also
means that the thing at the other end of the pipe close it for some
reason, in this case your task exited).
-Shawn
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden