diff options
| author | kennytm <kennytm@gmail.com> | 2018-04-24 11:56:59 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-04-24 11:56:59 +0800 |
| commit | cefdd6d5e99618f193c1cd3365aa18b786731d97 (patch) | |
| tree | 60aa48abb565aa82f705374121dfa22905acefc5 /src/libstd | |
| parent | a1286f6835ade2d46b936100acd82d44093b3b68 (diff) | |
| parent | bc4bd5642ab7ccfdaf84c95c8b62f620acbca644 (diff) | |
| download | rust-cefdd6d5e99618f193c1cd3365aa18b786731d97.tar.gz rust-cefdd6d5e99618f193c1cd3365aa18b786731d97.zip | |
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.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/process.rs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/libstd/process.rs b/src/libstd/process.rs index 92f0406c09b..00051d4487a 100644 --- a/src/libstd/process.rs +++ b/src/libstd/process.rs @@ -1121,8 +1121,13 @@ impl ExitCode { } impl Child { - /// Forces the child to exit. This is equivalent to sending a - /// SIGKILL on unix platforms. + /// Forces the child process to exit. If the child has already exited, an [`InvalidInput`] + /// 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 /// @@ -1138,6 +1143,10 @@ impl Child { /// 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")] pub fn kill(&mut self) -> io::Result<()> { self.handle.kill() |
