Rollup merge of #31327 - dirk:dirk/process-child-safety-docs, r=alexcrichton
`Drop` is not 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. r? @steveklabnik
This commit is contained in:
commit
b2f3a51e1a
1 changed files with 10 additions and 0 deletions
|
|
@ -47,6 +47,16 @@ use thread::{self, JoinHandle};
|
|||
///
|
||||
/// assert!(ecode.success());
|
||||
/// ```
|
||||
///
|
||||
/// # Note
|
||||
///
|
||||
/// Take note that there is no implementation of
|
||||
/// [`Drop`](../../core/ops/trait.Drop.html) for child processes, so if you
|
||||
/// do not ensure the `Child` has exited then it will continue to run, even
|
||||
/// after the `Child` handle to the child process has gone out of scope.
|
||||
///
|
||||
/// Calling `wait` (or other functions that wrap around it) will make the
|
||||
/// parent process wait until the child has actually exited before continuing.
|
||||
#[stable(feature = "process", since = "1.0.0")]
|
||||
pub struct Child {
|
||||
handle: imp::Process,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue