[erlang-questions] {badarg, [{code_server, call, 2}, {error_handler, undefined_function, 3}]}

David Tucker dbtleonia@REDACTED
Tue Dec 9 07:10:24 CET 2008


Thanks for the info.  Is there a clean way to shut down a process that is
blocking on io:get_line()?

Dave


On Mon, Dec 8, 2008 at 10:08 PM, Bernard Duggan <bernie@REDACTED> wrote:

> While someone else can probably explain exactly why you're getting that
> particular message (I could guess, but I'd probably get it wrong), I can
> at least tell you why your test isn't working :)
> The use of "-s init stop" tells the erts to execute "init:stop" as soon
> as the previous function ("inp:start") returns.  The problem you're
> having is that inp:start spawns a thread and returns straight away.  The
> erts then calls init:stop, killing off the whole elang vm (and,
> presumably, creating some kind of error condition in the remaining
> thread which is the output you're seeing).
> You need to either have inp:start wait until its child process has
> completed (perhaps with a 'receive' block), or not tell the vm to shut
> down using "-s init stop".
>
> Hope that's some help.
>
> Cheers,
>
> Bernard
>
> David Tucker wrote:
> > Hi folks,
> >
> > My simple program below gives an error on exit.  Any idea what is
> > wrong?  Thanks.
> >
> > Dave
> >
> > ---
> >
> > $ cat inp.erl
> > -module(inp).
> > -compile(export_all).
> >
> > start() ->
> >     spawn(fun() -> one_line() end).
> >
> > one_line() ->
> >     case io:get_line("") of
> >      Str -> lib:nonl(Str)
> >     end.
> > $ erlc inp.erl
> > $ erl -noshell -s inp start -s init stop
> > {error_logger,{{2008,12,8},{21,39,50}},"~s~n",["Error in process
> > <0.28.0> with exit value:
> > {badarg,[{code_server,call,2},{error_handler,undefined_function,3}]}\n"]}
> > $ port info erlang | head -1
> > erlang R12B-5, lang/erlang (Variants: universal, smp, ssl, hipe, i386)
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > erlang-questions mailing list
> > erlang-questions@REDACTED
> > http://www.erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20081208/6cd13a04/attachment.htm>


More information about the erlang-questions mailing list