The function reports {error, {AppName,Reason}} for errors, where Reason is any possible reason returned by start/1,2 when starting a specific dependency.
Ulf Wiger <u...@wiger.net> wrote:
> Permissions are a bit tricky. :)
Indeed. This discussion prompted me to use permissions for a use case
of my own, but the system behaved really strange. Eventually I found
the problem. Have a look at this:
Eshell V11.1.4 (abort with ^G)
1> application:load(sasl).
ok
2> application:permit(sasl, false).
ok
3> application:start(sasl).
ok
4> application:permit(sasl, true).
ok
5> application:which_applications().
[{sasl,"SASL CXC 138 11","4.0.1"},
{stdlib,"ERTS CXC 138 10","3.14"},
{kernel,"ERTS CXC 138 10","7.2"}]
This is fine and as expected. But now let's throw in an additional
permit false:
Eshell V11.1.4 (abort with ^G)
1> application:load(sasl).
ok
2> application:permit(sasl, false).
ok
3> application:start(sasl).
ok
4> application:permit(sasl, false). % <-- HERE
ok
5> application:permit(sasl, true).
ok
6> application:which_applications().
[{stdlib,"ERTS CXC 138 10","3.14"},
{kernel,"ERTS CXC 138 10","7.2"}]
Now sasl isn't started!
It turns out that the second permit false will remove the
application from the start_p_false list in application_controller.erl:
%% start requested but not started because permit was false
{false, {true, _Appl}, false, {value, _Tuple}, false, false} ->
update_permissions(AppName, Bool),
SS = S#state{start_p_false = keydelete(AppName, 1, SPF)},
{reply, ok, SS};
This doesn't seem right. I think this should be a noop.
/martin