How do supervisors not crash?

How do supervisors not crash when their children do?

When you start an Agent or GenServer they will be linked to the current process and the current process will crash if the linked Agent or GenServer crashes. However Supervisors do not crash even if the child processes that are linked to the supervisor crash. Well, the answer is obvious.

Because Supervisors trap the exit signals.source code

Assuming that you’ve at least one child spec in your children list below, you can also confirm that doing:

{:ok, supervisor} = Supervisor.start_link(children, strategy: :one_for_one)

Process.info(supervisor, :trap_exit)
# => {:trap_exit, true}