weird.<br> <br>Why "erl -pa ebin -s mysample_app start x y" doesn't work, but "erl -pa ebin -s application start mysample" works, <br><br>is it a bug in erlang? <br><br><br><div class="gmail_quote">
On Mon, Mar 5, 2012 at 10:21 PM, Ryan Huffman <span dir="ltr"><<a href="mailto:ryanhuffman@gmail.com">ryanhuffman@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="font-family:Helvetica;font-size:13px">It looks like you are trying to call your state function with 0 arguments, but the start function has an arity of 2 (it expects 2 arguments). You can add 2 dummy arguments or use `-s application start mysample` instead.<br>
</div><div><div class="h5">
<div></div>
<p style="color:#a0a0a8">On Monday, March 5, 2012 at 10:07 PM, envelopes envelopes wrote:</p>
</div></div><blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px">
<span><div><div><div class="h5"><div><br>I have a sample program generated from rebar<br><br>1. mysample_app.erl<br><br>-module(mysample_app).<br><br>-behaviour(application).<br><br>%% Application callbacks<br>
-export([start/2, stop/1, main/1]).<br><br>%% ===================================================================<br>
%% Application callbacks<br>%% ===================================================================<br><br>start(_StartType, _StartArgs) -><br> mysample_sup:start_link().<br><br>stop(_State) -><br> ok.<br><br>
<br>
main([A]) -><br>I = list_to_integer(atom_to_list(A)),<br>F = fac(I),<br>io:format("factorial ~w = ~w~n" ,[I, F]),<br>init:stop().<br>fac(0) -> 1;<br>fac(N) -> N*fac(N-1).<br><br><br>2. mysample_sup.erl<br>
<br><br>-module(mysample_sup).<br><br>-behaviour(supervisor).<br><br>%% API<br>-export([start_link/0]).<br><br>%% Supervisor callbacks<br>-export([init/1]).<br><br>%% Helper macro for declaring children of supervisor<br>
-define(CHILD(I, Type), {I, {I, start_link, []}, permanent, 5000, Type, [I]}).<br>
<br>%% ===================================================================<br>%% API functions<br>%% ===================================================================<br><br>start_link() -><br> supervisor:start_link({local, ?MODULE}, ?MODULE, []).<br>
<br>%% ===================================================================<br>%% Supervisor callbacks<br>%% ===================================================================<br><br>init([]) -><br> {ok, { {one_for_one, 5, 10}, []} }.<br>
<br><br>3) the problem.<br>erl -pa ebin -s mysample_app main 23 ===> worked fine<br>erl -pa ebin -s mysample_app start ===> crashed on boot.<br><br>{"init terminating in do_boot",{undef,[{mysample_app,start,[],[]},{init,start_it<br>
,1,[{file,"init.erl"},{line,1042}]},{init,start_em,1,[{file,"init.erl"},{line,10<br>22}]}]}}<br><br>Crash dump was written to: erl_crash.dump<br>init terminating in do_boot ()<br><br>what is the cause ? my erlang is the latest R15.<br>
</div></div></div><div><div>_______________________________________________</div><div>erlang-questions mailing list</div><div><a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a></div>
<div><a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a></div></div></div></span>
</blockquote>
<div>
<br>
</div>
</blockquote></div><br>