1
Fork 0

Return Ok on kill if process has already exited

This commit is contained in:
Chris Denton 2023-06-13 20:32:31 +01:00
parent 2ca8d358e5
commit e7fda447e7
No known key found for this signature in database
GPG key ID: 713472F2F45627DE
4 changed files with 17 additions and 14 deletions

View file

@ -1904,8 +1904,8 @@ impl FromInner<imp::ExitCode> for ExitCode {
}
impl Child {
/// Forces the child process to exit. If the child has already exited, an [`InvalidInput`]
/// error is returned.
/// Forces the child process to exit. If the child has already exited, `Ok(())`
/// is returned.
///
/// The mapping to [`ErrorKind`]s is not part of the compatibility contract of the function.
///
@ -1920,7 +1920,7 @@ impl Child {
///
/// let mut command = Command::new("yes");
/// if let Ok(mut child) = command.spawn() {
/// child.kill().expect("command wasn't running");
/// child.kill().expect("command couldn't be killed");
/// } else {
/// println!("yes command didn't start");
/// }