Re: Application is crashing if it runs for long time (On NSTask)
Re: Application is crashing if it runs for long time (On NSTask)
- Subject: Re: Application is crashing if it runs for long time (On NSTask)
- From: Charles Srstka <email@hidden>
- Date: Fri, 11 Oct 2002 19:48:21 -0500
Run it in the debugger, and when it crashes, click on startShellScript
in the list of methods that are running. It should highlight the exact
line where it's crashing. That should help narrow it down.
Charles
On Friday, October 11, 2002, at 04:25 PM, Raghunatha Reddy wrote:
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] initWithData:[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.
_______________________________________________
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.