Re: NSTask Memory Problems
Re: NSTask Memory Problems
- Subject: Re: NSTask Memory Problems
- From: Owen Anderson <email@hidden>
- Date: Fri, 23 Jan 2004 17:10:40 -0500
Alright, I acted on the suggestions I got and modified the code like
such. However, it STILL SIGBUSs
-(NSArray*)findIt:(NSURL*)theURL
{
NSString* finder = [[[NSBundle mainBundle] pathForResource:@"finder"
ofType:@"py"] stringByStandardizingPath];
NSString* target = [theURL absoluteString];
NSString* tmpString = [[NSString alloc] init];
NSTask* search = [[NSTask alloc] init];
[search setLaunchPath:@"/usr/bin/python"];
NSMutableArray* args = [[NSMutableArray alloc] init];
[args addObject:finder];
[args addObject:target];
[search setArguments:args];
[search setStandardOutput:[NSPipe pipe]];
[search setCurrentDirectoryPath:@"/"];
[search launch];
NSData *data = nil;
while ([search isRunning]) {
data = [[[search standardOutput] fileHandleForReading] availableData];
if ((data != nil) && [data length]) {
tmpString = [tmpString stringByAppendingString:[[[NSString alloc]
initWith
Data:data
encoding:NSUTF8StringEncoding] autorelease]];
}
}
[args release];
[search release];
return [tmpString componentsSeparatedByString:@"\n"];
}
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.