• 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
Re: NSTask terminates when NSApplication exits
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTask terminates when NSApplication exits


  • Subject: Re: NSTask terminates when NSApplication exits
  • From: Jens Alfke <email@hidden>
  • Date: Wed, 18 Jan 2012 12:38:49 -0800

On Jan 18, 2012, at 10:59 AM, Andrew wrote:

> I am trying to write a program that maintains different installs of
> another program including launching the program. To do so, I am using
> NSTask. Now when I quit my cocoa app. the NSTask app dies. …
>  According to what I have read, the application should keep
> running even when the parent task exits.

Nope. In Unix, a process is killed when its parent process exits. This is one reason why you shouldn't launch application processes directly :) Instead, use NSWorkspace to launch the app (or call LaunchServices directly if you prefer a C API.) This starts it up in the normal way, as a subprocess of your login session’s main launchd process.

—Jens

_______________________________________________

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

  • Follow-Ups:
    • Re: NSTask terminates when NSApplication exits
      • From: Scott Ribe <email@hidden>
    • Re: NSTask terminates when NSApplication exits
      • From: Kyle Sluder <email@hidden>
References: 
 >NSTask terminates when NSApplication exits (From: Andrew <email@hidden>)

  • Prev by Date: Re: Printing an NSDate
  • Next by Date: Re: NSTask terminates when NSApplication exits
  • Previous by thread: Re: NSTask terminates when NSApplication exits
  • Next by thread: Re: NSTask terminates when NSApplication exits
  • Index(es):
    • Date
    • Thread