<div dir="ltr">Here's a quote from the docs that T Ty mentioned:<div><br></div><div><dt style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:medium"><strong><span class="" style="font-family:Courier,monospace;font-weight:normal">-s Mod [Func [Arg1, Arg2, ...]]</span>(init flag)</strong></dt><dd style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:medium"><p>Makes <span class="" style="font-family:Courier,monospace">init</span> call the specified function. <span class="" style="font-family:Courier,monospace">Func</span> defaults to <span class="" style="font-family:Courier,monospace">start</span>. If no arguments are provided, the function is assumed to be of arity 0. Otherwise it is assumed to be of arity 1, taking the list <span class="" style="font-family:Courier,monospace">[Arg1,Arg2,...]</span> as argument. All arguments are passed as atoms. See <span class="" style="font-family:Courier,monospace;font-weight:bold"><a href="http://erlang.org/doc/man/init.html" style="color:blue;text-decoration:none">init(3)</a></span>.</p></dd></div><div>So when you pass <span style="font-family:Arial;font-size:14.3999996185303px;color:rgb(0,0,255);line-height:23.7999992370605px">-</span><span style="font-family:Arial;font-size:14.3999996185303px;color:rgb(0,0,255);line-height:23.7999992370605px">s application ensure_all_started dummy_proj</span></div><div>to erl, it's going to call application:ensure_all_started([dummy_proj]) (note that the argument is a single element list), which is not what you want.</div><div><br></div><div>I struggled with the best way to deal with this for a while, and eventually created a little helper module that looks like this:</div><div><br></div><div><div>-module(app).</div><div><br></div><div>%% @doc Allow applications to be started from command line: -s app start application-name</div><div><br></div><div>-export([start/1]).</div><div><br></div><div>start([App]) -></div><div>   application:start(App).</div></div><div><br></div><div>and seems to work well enough for my purposes. You will want to either change the last line to application:ensure_all_started(App), or create a separate function that calls ensure_all_started. YMMV.</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 22, 2014 at 10:32 AM, 张国富 <span dir="ltr"><<a href="mailto:cleancode@163.com" target="_blank">cleancode@163.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="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div>Thanks, it is very helpful.</div><div>Now I added a module dummy_proj and the start function is implemented, finally it's working by </div><span class=""><div><span style="color:rgb(0,0,255);line-height:23.7999992370605px">$ erl -pa apps/ebin/ -boot start_sasl -s dummy_proj</span></div><div><span style="color:rgb(0,0,255);line-height:23.7999992370605px"><br></span></div></span><div><span style="color:rgb(0,0,0);line-height:23.7999992370605px">But personally I do not want to add a entire new module just for this purpose, So I tried something else.</span></div><div>However, another problem shows up, that when I start erl shell by </div><div><span style="color:rgb(0,0,255);line-height:23.7999992370605px">$ erl -pa apps/ebin/ -boot start_sasl -</span><span style="color:rgb(0,0,255);line-height:23.7999992370605px">s application start dummy_proj</span></div><div>or</div><div><span style="color:rgb(0,0,255);line-height:23.7999992370605px">$ erl -pa apps/ebin/ -boot start_sasl -</span><span style="color:rgb(0,0,255);line-height:23.7999992370605px">s application ensure_all_started dummy_proj</span></div><div></div><div></div><div>Nothing will go wrong but application dummy_proj will not be started at the same time.</div><div>On the other hand, if I try </div><div><span style="line-height:23.7999992370605px;color:rgb(0,0,255)">$ erl -pa apps/ebin/ -boot start_sasl -</span><span style="line-height:23.7999992370605px;color:rgb(0,0,255)">s appmon start</span></div><div>the AppMon tool will be started as expected.</div><div><br></div><div>That's to say the application:start(dummy_proj) was called, but nothing happened.</div><div>It's weird.</div><div><br></div><div>Best wishes.</div><div>zhangguofu (Gary)</div><div><br></div>在 2014-10-22 15:13:24,"T Ty" <<a href="mailto:tty.erlang@gmail.com" target="_blank">tty.erlang@gmail.com</a>> 写道:<div><div class="h5"><br> <blockquote style="PADDING-LEFT:1ex;MARGIN:0px 0px 0px 0.8ex;BORDER-LEFT:#ccc 1px solid"><div dir="ltr">According to the Erlang documentation <div><br></div><div><a href="http://erlang.org/doc/man/erl.html" target="_blank">http://erlang.org/doc/man/erl.html</a> when you call<br></div><div><br></div><div>    erl -s module</div><div><br></div><div>And no other arguments provided it defaults to Func "start" and if no arguments are provided,
          the function is assumed to be of arity 0.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 21, 2014 at 11:48 PM, Jay Doane <span dir="ltr"><<a href="mailto:jay@almery.com" target="_blank">jay@almery.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I believe this line<span><div><br></div><div><span style="color:rgb(255,0,0);font-family:Arial;font-size:14.3999996185303px;line-height:19.0399990081787px">{"init terminating in do_boot",{undef,[{dummy_proj,</span><span style="color:rgb(255,0,0);font-family:Arial;font-size:14.3999996185303px;line-height:19.0399990081787px">start,[],[]},{init,start_it,1,</span><span style="color:rgb(255,0,0);font-family:Arial;font-size:14.3999996185303px;line-height:19.0399990081787px">[]},{init,start_em,1,[]}]}}</span><br></div><div><br></div></span><div>indicates that the function start/0 is not defined in module dummy_proj, so if you want to start it like that on the command line, you could try adding something like the following to dummy_proj.erl:</div><div>-export([start/1]).</div><div>start() -><br></div><div>    application:ensure_all_started(dummy_proj).</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div>On Tue, Oct 21, 2014 at 1:33 PM, 张国富 <span dir="ltr"><<a href="mailto:cleancode@163.com" target="_blank">cleancode@163.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div>Hello all,</div><div>I'm now following a Erlang rebar tutorial at <a href="http://www.metabrew.com/article/erlang-rebar-tutorial-generating-releases-upgrades" target="_blank">http://www.metabrew.com/article/erlang-rebar-tutorial-generating-releases-upgrades</a>, the test application can be started inside the erlang shell, like</div><div><span style="color:rgb(0,0,255)">$ erl -pa apps/ebin/ -boot start_sasl</span></div><div><div><span style="color:rgb(0,0,255)">1> application:start(dummy_proj). </span></div><div><span style="color:rgb(0,0,255)">=PROGRESS REPORT==== 21-Oct-2014::21:16:13 ===</span></div><div><span style="color:rgb(0,0,255)">         application: dummy_proj</span></div><div><span style="color:rgb(0,0,255)">          started_at: nonode@nohost</span></div><div><span style="color:rgb(0,0,255)">ok</span></div><div><span style="color:rgb(0,0,255)">2> dummy_proj_server:poke().</span></div><div><span style="color:rgb(0,0,255)">{ok,1}</span></div></div><div>but it can not be started this way</div><div><div><span style="color:rgb(0,0,255)">$ erl -pa apps/ebin/ -boot start_sasl -</span><span style="color:rgb(255,0,0)">s dummy_proj</span></div><div><span style="color:rgb(0,0,255)">Erlang R16B03 (erts-5.10.4) [source] [smp:4:4] [async-threads:10] [kernel-poll:false]</span></div><div><span style="color:rgb(0,0,255)">.... <skip> .....</span></div><div><span style="color:rgb(0,0,255)">=PROGRESS REPORT==== 21-Oct-2014::21:17:23 ===</span></div><div><span style="color:rgb(0,0,255)">         application: sasl</span></div><div><span style="color:rgb(0,0,255)">          started_at: nonode@nohost</span></div><div><span style="color:rgb(255,0,0)">{"init terminating in do_boot",{undef,[{dummy_proj,start,[],[]},{init,start_it,1,[]},{init,start_em,1,[]}]}}</span></div><div><div><span style="color:rgb(0,0,255)">Crash dump was written to: erl_crash.dump</span></div><div><span style="color:rgb(0,0,255)">init terminating in do_boot ()</span></div></div></div><div><br></div><div><span style="color:rgb(0,0,0)">It seems Erlang is trying to call </span><span style="color:rgb(0,0,255)">dummy_proj:start()</span><span style="color:rgb(0,0,0)">, but I can not understand why.</span></div><div><span style="color:rgb(0,0,0)">Anybody who ever encountered the same problem here? How can I make it work?</span></div><div><br></div><div><font color="#0000ff"><span style="color:rgb(0,0,0)">Thanks.</span></font></div><div><font color="#0000ff"><br></font></div><div><font color="#0000ff"><span style="color:rgb(0,0,0)">Best wishes</span></font></div><div><font color="#0000ff"><br></font></div><div><font color="#0000ff"><span style="color:rgb(0,0,0)">zhangguofu(Gary)</span></font></div><div><br></div><div><br></div></div><br><br><span title="neteasefooter"><span></span></span><br></div></div>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div><br></div>
<br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div><br></div>
</blockquote></div></div></div><br><br><span title="neteasefooter"><span></span></span><br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div><br></div>