Skip to main content

cleanup_on_exit

Function cleanup_on_exit 

Source
pub async fn cleanup_on_exit(
    main_process: impl Future<Output = Result<()>>,
    task_group: TaskGroup,
) -> Result<()>
Expand description

Runs main_process until it finishes or the task group is told to shut down, then shuts the task group down and joins it on every exit path, so that tasks still holding daemons finish inside the runtime instead of being dropped by its shutdown. Callers tear their daemons down explicitly afterwards.