I have something like:
- (NSString *)unixSinglePathCommandWithReturn:(NSString *)command
{
NSPipe *newPipe = [NSPipe pipe];
NSFileHandle *readHandle = [newPi
The problem is that you aren't emptying the output buffers of the task. You can't simply launch a task and waitUntilDone
unless the task also emits an extremely small amount of data.
waitUntilDone
will obviously not work at all with a task that never exits.
For a task that emits any quantity of output, you need to set it up such that the output is read as it is generated. Typically, you use readInBackgroundAndNotify
or a variant therein.
In any case, the top of the class description for NSTask
has both links to the conceptual guide and to a series of examples that cover this.