Q: Supervision and Magically Reincarnated Processes

Vance Shipley <>
Mon Dec 16 21:39:01 CET 2002


Bruce,

You need to do the following in your init/1 function:

	process_flag(trap_exit, true)

Normally the {'EXIT', Pid, Reason} message is handled for you but after
setting this you will receive it in your handle_info/2 call back.  You
can do cleanup/reporting and return {stop,Reason,NewState}.  Now terminate/2
will be called.  Afterwards the supervisor will start it up again.

	-Vance

On Mon, Dec 16, 2002 at 09:18:14PM +1300, Bruce Fitzsimons wrote:
}  
}  The process that dies is a gen_server (behaviour) and it doesn't execute its
}  terminate(Reason, State) so I guess its just 'EXIT'ing somewhere.
}  
}  My question is: how can I trap this (preferably sans debugger)?



More information about the erlang-questions mailing list