Gen processes and exit/2 from shell

Vladimir Sekissov <>
Tue Dec 17 01:35:16 CET 2002


Good day,

Could somebody explain me why gen_* processes don't trap

exit(GenProcessPid, Reson)

if it executed from erlang shell when ordinary processes do?

33> T = spawn_link(fun () ->
                    process_flag(trap_exit, true),
                    receive Msg ->
                      io:format("msg: ~w~n", [Msg])
                    end
                  end).
<0.97.0>
34> exit(T, myreson).
msg: {'EXIT',<0.73.0>,myreson}

But

35> {ok, P} = gen_serv_with_trap_exit:start_link().
{ok, <0.99.0>}

36> exit(P, myreson).

=ERROR REPORT==== 17-Dec-2002::04:19:17 ===
** Generic server test_exit terminating 
** Last message in was {'EXIT',<0.73.0>,myreson}
** When Server state == {state}
...

Best Regards,
Vladimir Sekissov



More information about the erlang-questions mailing list