From 7eb9a091f3ab8e77978ad5c8369f2fb4bedc2610 Mon Sep 17 00:00:00 2001 From: Andreas Tolfsen Date: Wed, 28 Mar 2018 18:54:34 +0100 Subject: [PATCH 1/5] 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. --- src/libstd/process.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libstd/process.rs b/src/libstd/process.rs index 92e9f48f7ebef..b3cb8d745b466 100644 --- a/src/libstd/process.rs +++ b/src/libstd/process.rs @@ -1121,8 +1121,9 @@ 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 error is returned. + /// + /// This is equivalent to sending a SIGKILL on Unix platforms. /// /// # Examples /// From d541282d6c578fcb09000bd4747dd7f08ccd3805 Mon Sep 17 00:00:00 2001 From: Andreas Tolfsen Date: Wed, 28 Mar 2018 23:05:51 +0100 Subject: [PATCH 2/5] fixup! std: Child::kill() returns error if process has already exited --- src/libstd/process.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libstd/process.rs b/src/libstd/process.rs index b3cb8d745b466..4d4a48bd2da8f 100644 --- a/src/libstd/process.rs +++ b/src/libstd/process.rs @@ -1121,7 +1121,8 @@ impl ExitCode { } impl Child { - /// Forces the child process to exit. If the child has already exited, an error is returned. + /// Forces the child process to exit. If the child has already exited, an [`InvalidInput`] + /// error might be returned. /// /// This is equivalent to sending a SIGKILL on Unix platforms. /// @@ -1139,6 +1140,8 @@ impl Child { /// println!("yes command didn't start"); /// } /// ``` + /// + /// [`InvalidInput`]: ../io/enum.ErrorKind.html#variant.InvalidInput #[stable(feature = "process", since = "1.0.0")] pub fn kill(&mut self) -> io::Result<()> { self.handle.kill() From 51dc6304e71b95ad26f697db56c0bc2e6df5dd47 Mon Sep 17 00:00:00 2001 From: Andreas Tolfsen Date: Thu, 29 Mar 2018 18:10:40 +0100 Subject: [PATCH 3/5] fixup! std: Child::kill() returns error if process has already exited --- src/libstd/process.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/libstd/process.rs b/src/libstd/process.rs index 4d4a48bd2da8f..c3d681a896262 100644 --- a/src/libstd/process.rs +++ b/src/libstd/process.rs @@ -1122,7 +1122,10 @@ impl ExitCode { impl Child { /// Forces the child process to exit. If the child has already exited, an [`InvalidInput`] - /// error might be returned. + /// 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. /// @@ -1141,7 +1144,9 @@ impl Child { /// } /// ``` /// + /// [`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() From fd2afa01aa614114811ff68ed31c146f7aab1d28 Mon Sep 17 00:00:00 2001 From: Andreas Tolfsen Date: Sun, 8 Apr 2018 16:20:15 +0100 Subject: [PATCH 4/5] fixup! std: Child::kill() returns error if process has already exited --- src/libstd/process.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libstd/process.rs b/src/libstd/process.rs index c3d681a896262..60759de8afc3a 100644 --- a/src/libstd/process.rs +++ b/src/libstd/process.rs @@ -1146,7 +1146,7 @@ impl Child { /// /// [`ErrorKind`]: ../io/enum.ErrorKind.html /// [`InvalidInput`]: ../io/enum.ErrorKind.html#variant.InvalidInput - /// [`Other]: ../io/enum.ErrorKind.html#variant.Other + /// [`Other`]: ../io/enum.ErrorKind.html#variant.Other #[stable(feature = "process", since = "1.0.0")] pub fn kill(&mut self) -> io::Result<()> { self.handle.kill() From bc4bd5642ab7ccfdaf84c95c8b62f620acbca644 Mon Sep 17 00:00:00 2001 From: Andreas Tolfsen Date: Tue, 17 Apr 2018 08:00:48 +0100 Subject: [PATCH 5/5] fixup! std: Child::kill() returns error if process has already exited --- src/libstd/process.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libstd/process.rs b/src/libstd/process.rs index 60759de8afc3a..431226453ff28 100644 --- a/src/libstd/process.rs +++ b/src/libstd/process.rs @@ -1121,7 +1121,7 @@ impl ExitCode { } impl Child { - /// Forces the child process to exit. If the child has already exited, an [`InvalidInput`] + /// 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,