[launchd-dev] ~/LaunchAgent + KeepAlive=true = Login Jail

Dave Zarzycki zarzycki at apple.com
Fri Jan 25 11:14:05 PST 2008


Please file a bug:

http://bugreport.apple.com/

Thanks!

davez


On Jan 25, 2008, at 10:21 AM, James Bucanek wrote:

> Greetings,
>
> I have a user launch agent (~/Library/LaunchAgents) that has  
> KeepAlive set to true. The launch agent is a Cocoa application,  
> UIElement=YES. It provides a small status window to the user.
>
> I want this application to run all of the time, which is why the  
> KeepAlive property was set. Whenever my application quits, launchd  
> restarts it (as one would expect). The problem is that when the user  
> tries to log out, the agent quits, launchd immediately restarts it,  
> and the user gets a nasty message that the logout/restart/shutdown  
> was canceled by my application.
>
> [There's clearly an amusing race condition: Once it's down to the  
> Finder, launchd, my application and maybe one or two other small  
> applications, the system manages to log out by killing my app and  
> launchd before launchd has a chance to restart my application again.]
>
> Anyway, is there a workaround for this or do I just have to abandon  
> KeepAlive?
>
> -- 
> James Bucanek
>
> _______________________________________________
> launchd-dev mailing list
> launchd-dev at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo/launchd-dev



More information about the launchd-dev mailing list