• 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
Application is crashing if it runs for long time (On NSTask)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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] 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.

  • Follow-Ups:
    • Re: Application is crashing if it runs for long time (On NSTask)
      • From: Charles Srstka <email@hidden>
  • Prev by Date: Re: Cocoa Books (was New to Cocoa)
  • Next by Date: Re: looking for code snippet
  • Previous by thread: [ANN] Report on AppleScript 1.9 in Jaguar
  • Next by thread: Re: Application is crashing if it runs for long time (On NSTask)
  • Index(es):
    • Date
    • Thread