Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problems with a NSTask



I'm using a NSTask to run a command line program, and feed the output back into a text view.

I'm doing this by using "readInBackgroundAndNotify" to allow the command line to run in the background
and I use a polling method to put the collected string into the text view in chunks. That way the user interface will never hold up the command line.

So far so good.

However, if my command line program crashes it brings the graphical application down with it.
I would have expected a NSTaskDidTerminateNotification notification to be sent, which is what happens
when the command line program quits naturally.

The following program will cause this:
int main()
{
cerr << "About to crash.";
int *OhNo = 0;
OhNo[32] = 3;
return 1;
}

Is there other notification that I should listen to? There has to be a clean way of dealing
with this, bugs happen :)

David




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.