scoped_task/
lib.rs

1// Copyright 2020 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5//! `scoped_task` provides wrappers that kill a child process when the
6//! wrapper goes out of scope, or the current process exits.
7//!
8//! Note that this doesn't guarantee that the child process will be killed in
9//! all cases: if the current process is terminated, or exits with
10//! [`std::process::abort`], the child process will not be killed. Panics and
11//! [`std::process::exit`] are explicitly supported, however.
12//!
13//! These wrappers are especially useful for tests that spawn child processes.
14//! If an assert fails, the child process can live forever. This can cause the
15//! test runner to hang if the child process cloned the test's stdout or stderr
16//! handle, which is often the case.
17//!
18//! For this reason, it is recommended that all Rust tests which spawn processes
19//! use `scoped_task` to do so.
20
21mod zircon;
22
23pub use zircon::{create_child_job, install_hooks, job_default, spawn, spawn_etc, Scoped};