Skip to content

Commit

Permalink
Safety docs about std::process::Child going out of scope
Browse files Browse the repository at this point in the history
There is no `Drop` implemented for `Child`, so if it goes out
of scope in Rust-land and gets deallocated, the child process
will continue to exist and execute. If users want a guarantee
that the process has finished running and exited they must
manually use `kill`, `wait`, or `wait_with_output`.

Fixes #31289.
  • Loading branch information
dirk committed Jan 31, 2016
1 parent 9041b93 commit cee1695
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/libstd/process.rs
Expand Up @@ -47,6 +47,14 @@ use thread::{self, JoinHandle};
///
/// assert!(ecode.success());
/// ```
///
/// # Safety
///
/// Take note that there is no implementation of
/// [`Drop`](../../core/ops/trait.Drop.html) for child processes, so if you
/// not ensure the `Child` has exited (through `kill`, `wait`, or
/// `wait_with_output`) then it will continue to run even after the `Child`
/// handle to it has gone out of scope.
#[stable(feature = "process", since = "1.0.0")]
pub struct Child {
handle: imp::Process,
Expand Down

0 comments on commit cee1695

Please sign in to comment.