Re: Reading data from an NSTask
Re: Reading data from an NSTask
- Subject: Re: Reading data from an NSTask
- From: j o a r <email@hidden>
- Date: Mon, 4 Jul 2005 22:47:13 +0200
On 4 jul 2005, at 22.33, Ken Tozier wrote:
I just re-read the NSTask documentation and I still don't get the
impression that NSTasks can only be run asynchronously. One of it's
methods "waitUntilExit" states:
"Suspends your program until the receiver is finished. This method
first checks to see if the receiver is still running using
isRunning. Then it polls the current run loop using
NSDefaultRunLoopMode until the task completes."
Which I'm interpreting as a synchronous way to use NSTasks. Correct?
Right, and if you DON'T set up the output pipes, it will probably
work just fine - try it out!
I may have to go the asynchronous route, but it seems like I'm just
making a minor error here. It should work. Any glaring errors jump
out at anyone?
Just the one I've mentioned from the start:
"Your program can communicate with the task by attaching one or more
NSPipe instances to the task’s standard input, output, or error
devices before launching the task. A pipe is a one-way communications
channel between related processes; one process writes data while the
other process reads that data. The data that passes through the pipe
is buffered; the size of the buffer is determined by the underlying
operating system."
Once you try to funnel the output of your task into the pipe, you're
subject to the limitations of that pipe.
j o a r
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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