Supervisor Linked to Shell

David N Murray <>
Fri Apr 23 15:08:52 CEST 2010


Hi all,

Newbie question.  I have:

-module(t).
-behavior(supervisor).
-export([start/0, init/1]).

start() ->
    supervisor:start_link(?MODULE, []).

init(_) ->
    {ok, {{one_for_one, 3, 3600}, []}}.

128> t:start().
{ok,<0.683.0>}

I'm developing in Emacs.  If I make a mistake in the shell, it brings down
the supervisor:

129> crash().
** exception error: undefined shell command crash/0
     in function  erlang:error/1
        called as erlang:error({shell_undef,crash,0})

=ERROR REPORT==== 23-Apr-2010::09:06:08 ===
** Generic server <0.683.0> terminating
** Last message in was {'EXIT',<0.676.0>,
                               {{shell_undef,crash,0},
                                [{erlang,error,[{shell_undef,crash,0}]},
                                 {shell,shell_undef,2},
                                 {erl_eval,local_func,5},
                                 {shell,exprs,7},
                                 {shell,eval_exprs,7},
                                 {shell,eval_loop,3}]}}
** When Server state == {state,{<0.683.0>,t},
                               one_for_one,[],
                               {dict,0,16,16,8,80,48,

{[],[],[],[],[],[],[],[],[],[],[],[],[],
                                      [],[],[]},

{{[],[],[],[],[],[],[],[],[],[],[],[],[],
                                       [],[],[]}}},
                               3,3600,[],t,[]}
** Reason for termination ==
** {{shell_undef,crash,0},
    [{erlang,error,[{shell_undef,crash,0}]},
     {shell,shell_undef,2},
     {erl_eval,local_func,5},
     {shell,exprs,7},
     {shell,eval_exprs,7},
     {shell,eval_loop,3}]}
130>

How can I prevent this?  From the book I'm using, it looks like
supervisor:start() was removed.  I'm using R13B04.

TIA,
Dave



More information about the erlang-questions mailing list