Re: communication with an NSTask
Re: communication with an NSTask
- Subject: Re: communication with an NSTask
- From: Paolo Manna <email@hidden>
- Date: Sat, 17 May 2003 13:09:56 +0200
On Friday, 16 May 2003 at 23:38:11, Daniel Aarno wrote:
The problem is that when all goes well and app 1 exits, app 2 dies! I
guess this is because the stdout, stderr file descriptors of app 2 is
not closed correctly and further writes to them will results in invalid
writes. Is this true?
Well, don't know about NSTask in particular, but in Unix a parent
process is supposed to "own" a child, thus when the parent dies the
child dies too, exactly what happens when you close a Terminal window
with something running in it... Any crash report? If there aren't, that
probably means that the process killing is perfectly legal...
Have you tried with the setsid() call in the child, _before_ letting
the parent die, or, even better, at the very beginning? It's supposed
to "detach" the child from the parent, making it autonomous... There
are on the 'net several examples, just search for 'Unix daemon'.
BTW, I don't know if a "&" as last argument, that's what it's used from
the command line to get the same effect, would work at all, as in the
docs it looks like the arguments don't go through the usual shell
parsing...
Cheers
Paolo
_______________________________________________
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.