Want a supervised task to finish (not get killed) during rolling #ElixirLang deployments?
Simply trap the exit:
Task.Supervisor.start_child(
MyApp.TaskSupervisor,
fn ->
Process.flag(:trap_exit, true)
do_work()
end
)
The task will have 5 seconds to finish.