Problems with a NSTask
Problems with a NSTask
- Subject: Problems with a NSTask
- From: David Adalsteinsson <email@hidden>
- Date: Sun, 9 Dec 2001 22:53:03 -0500
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