On 18 May 2010, at 20:33, appledev wrote: > [task launch]; > > [task waitUntilExit]; > > NSData *data; > result = [file readDataToEndOfFile];
This part is not safe. If the tasks output enough data to fill the pipe buffer (which may be of whatever size the kernel chooses to make it), then your program will hang on the -waitUntilExit line. You should instead do something like NSMutableData *result = [NSMutableData data]; NSData *chunk; while ((chunk = [file availableData]) && [chunk length]) [result appendData:chunk]; [task waitUntilExit]; There are obviously variations on that; if you can process the data as you go, that may be a better way to do it (but it's a bit complicated to do because there's no guarantee that the chunks you read won't straddle individual multi-byte characters). Kind regards, Alastair. -- http://alastairs-place.net _______________________________________________ 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