• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Application is crashing if it runs for long time (On NSTask)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Application is crashing if it runs for long time (On NSTask) (From: Raghunatha Reddy <email@hidden>)

  • Prev by Date: Re: Cocoa Books (was New to Cocoa)
  • Next by Date: Re: Seattle??? [was Re: Toronto cocoa programmers?]
  • Previous by thread: Application is crashing if it runs for long time (On NSTask)
  • Next by thread: { Semi-Newbie } Inverse of +initialize?
  • Index(es):
    • Date
    • Thread