How to terminate an NSTask whenever my app terminates?
How to terminate an NSTask whenever my app terminates?
- Subject: How to terminate an NSTask whenever my app terminates?
- From: Jens Alfke <email@hidden>
- Date: Mon, 31 Aug 2015 16:32:08 -0700
(I know this has come up here before, but I can’t get the right combination of search terms to find an answer…)
I’m writing a little GUI wrapper app around a command-line-based server. It uses NSTask to launch the server. I want to ensure that when the app exits, the server process exits too. I can tell the NSTask to terminate in my app delegate's -applicationWillTerminate: method, but that doesn’t handle cases where the app crashes or is force-quit.
IIRC there is a way to tell the kernel to terminate the child process when its parent process exits. But what is it, exactly?
—Jens
PS: As far as I know this is unrelated to the SIGHUP mechanism by which shells kill their child processes when they exit; that relies on having a TTY attached to the subprocess.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden