提交 b2f3a51e 编写于 作者: S Steve Klabnik

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
......@@ -47,6 +47,16 @@
///
/// 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,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册