[launchd-dev] ~/LaunchAgent + KeepAlive=true = Login Jail
James Bucanek
subscriber at gloaming.com
Fri Jan 25 10:21:50 PST 2008
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
More information about the launchd-dev
mailing list