Rollup merge of #49461 - andreastt:child-kill-exited, r=Mark-Simulacrum
std: Child::kill() returns error if process has already exited This patch makes it clear in std::process::Child::kill()'s API documentation that an error is returned if the child process has already cleanly exited. This is implied by the example, but not called out explicitly.
This commit is contained in:
commit
cefdd6d5e9
@ -1121,8 +1121,13 @@ impl ExitCode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Child {
|
impl Child {
|
||||||
/// Forces the child to exit. This is equivalent to sending a
|
/// Forces the child process to exit. If the child has already exited, an [`InvalidInput`]
|
||||||
/// SIGKILL on unix platforms.
|
/// error is returned.
|
||||||
|
///
|
||||||
|
/// The mapping to [`ErrorKind`]s is not part of the compatibility contract of the function,
|
||||||
|
/// especially the [`Other`] kind might change to more specific kinds in the future.
|
||||||
|
///
|
||||||
|
/// This is equivalent to sending a SIGKILL on Unix platforms.
|
||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
@ -1138,6 +1143,10 @@ impl Child {
|
|||||||
/// println!("yes command didn't start");
|
/// println!("yes command didn't start");
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
///
|
||||||
|
/// [`ErrorKind`]: ../io/enum.ErrorKind.html
|
||||||
|
/// [`InvalidInput`]: ../io/enum.ErrorKind.html#variant.InvalidInput
|
||||||
|
/// [`Other`]: ../io/enum.ErrorKind.html#variant.Other
|
||||||
#[stable(feature = "process", since = "1.0.0")]
|
#[stable(feature = "process", since = "1.0.0")]
|
||||||
pub fn kill(&mut self) -> io::Result<()> {
|
pub fn kill(&mut self) -> io::Result<()> {
|
||||||
self.handle.kill()
|
self.handle.kill()
|
||||||
|
Loading…
Reference in New Issue
Block a user