[launchd-dev] launch cocoa-app (with gui) from launchd
Bob Kells
bobkells at steelcape.com
Tue Dec 11 16:36:36 PST 2007
So now I know where the problem is, but not the solution.
First, my launchd plist is in ~/Library/LaunchAgents, and that is my
location when
I issue commands to launchctl. The OnDemand key/value is set to
true. I am looking
for files on a specific path via WatchPaths. I have 2 cmd-line args;
"-d 4 -p /Users/bob/LaunchScriptTest".
The launchd plist contains the Program key, and I have also set the
first arg to the app-name.
My cocoa app is used to generate custom NSAlert messages, and is
currently being executed
from a script file. Ideally, it will be executed by launchd
directly. The alert panels appear
correctly when I run the app from both the cmd-line and the script
file. When the app is run
from the same script file, when the script file is launched by
launchd, it hangs at the call to the
runModal method of my NSAlert object. I have tailed my system-log
and watched a list of info
messages from the app, and everything is ok. The cmd-line args sent
to the app from launchd
are correct. I have a custom object connected to the File's Owner in
IB, and issue the call to runModal
from the applicationDidFinishLaunching method. I know there are some
things that launchd
specifically says are prohibited, such as a fork/exit. Does runModal
attempt any of these restrictions?
This is an interesting problem.
Thanks for getting back to me so quickly...bob
On Dec 11, 2007, at 12:52 PM, Kevin Van Vechten wrote:
> Are you sure you're loading the job with the per-user launchd?
> Which directory is the launchd plist installed in?
>
> - Kevin
>
> On Dec 10, 2007, at 5:46 PM, bob kells wrote:
>
>> I have been unsuccessful so far attempting to launch an xcode
>> cocoa app
>> from launchd. I have tried loading 2 different versions of a
>> plist that
>> reference either
>> the executable, or the .app bundle. Neither works. I noticed a
>> prior
>> listing explaining
>> that the actual exe must be referenced, not the .app bundle. ps
>> shows that
>> the process actually gets
>> created both ways. However, nothing appears. I am able to launch
>> the app
>> successfully from a
>> script file and the cmd-line. But when the script file (which
>> launches the
>> app) is run
>> via launchd, again nothing happens. I am using WatchPaths, and
>> the Program
>> key has been set
>> to either the executable, or the .app bundle. Any suggestions out
>> there?
>> thanks...bob
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/launchd-dev/attachments/20071211/9500dfbd/attachment-0001.html
More information about the launchd-dev
mailing list