Application is crashing if it runs for long time (On NSTask)
Application is crashing if it runs for long time (On NSTask)
- Subject: Application is crashing if it runs for long time (On NSTask)
- From: Raghunatha Reddy <email@hidden>
- Date: Fri, 11 Oct 2002 14:25:05 -0700
Hi,
I have a application which runs a shell script. The script will be running
in a loop to capture some events.
The application runs fine for short time, and crashes if it runs for long
time. Any ideas?
I am calling the method "startShellScript" in a loop from other object. Do I
need to release the "handle" here?. I am getting the following error.
[NSCFDictionary setObject:forKey:]; attempt to insert nil value. Exited due
to signal 5.
- (NSString *) startShellScript:(NSArray *) args{
NSPipe *pipe=[[NSPipe alloc] init];
NSFileHandle *handle;
NSString *scriptReturn;
// initialize the task
NSLog(@"initialize the task");
//NSTask* script; declared in header
script = [[NSTask alloc] init];
[script setLaunchPath:path];
if (args != nil)
[script setArguments:args];
// I AM GUESSING IT IS FAILING HERE
[script setStandardOutput:pipe];
handle = [pipe fileHandleForReading];
[script launch];
[script waitUntilExit];
scriptReturn = [[NSString alloc] initWith
Data:[handle
readDataToEndOfFile] encoding:NSASCIIStringEncoding];
[pipe release];
[script release];
// This object is getting released in the caller method
return scriptReturn;
}
_______________________________________________
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.