[erlang-questions] supervising applications

Bob Ippolito <>
Wed Sep 20 02:12:10 CEST 2006


On 9/19/06, Moe Aboulkheir <> wrote:
> Hi,
>
> I'm very new to this.  I've written a trivial Erlang application, and i am trying to write a second one which provides a superset of the functionality of the first.  The supervisor that is started from start/2 in the second application tries to start the first application by including an entry for it in the list returned from init/1.  I tried the following two methods, but neither works:
>
> 1) Having StartFunc (in the init/1 term) as {application, start, [app1]}.  This doesn't work because application:start/1 returns ok instead of {ok, Pid} like the supervisor interface wants.  Ideally i'd have liked to be able to this, because app1:start/2 passes some stuff from its environment as the argument to app1_supervisor:start_link/1, but i guess i could move that stuff further into app1, though i saw an example that did the setup here, and it makes sense to me
>
> 2) Having StartFunc as {app1_supervisor, start_link, ...}.  This doesn't work because some code inside app1 depends on things in the environment of app1's .app file - things that don't seem to be available when i start it like this.  Again, i could move these variables into app2's environment, but i'd like to be able to use app1 without using app2, and would rather not maintain the information in two places.
>
> Any ideas?

Isn't this what you'd use the {applications, [app1, ...]} list for in
the .app file?

-bob



More information about the erlang-questions mailing list