Skip to content

Commit

Permalink
Clarify Child::kill behavior
Browse files Browse the repository at this point in the history
```
Child::kill       == std Child::kill + Child::wait
Child::start_kill == std Child::kill
```

As a side note, kill that also waits, is convenient, but also
dangerous, because `wait` may hang in certain cases (NFS, ptrace,
etc).  And different behavior between std and tokio may leads to
bugs when code is mechanically converted from one to another.  Better
name name of this function might be `kill_and_wait`.
  • Loading branch information
stepancheg committed Mar 6, 2025
1 parent 042433c commit f0eda26
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tokio/src/process/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1164,7 +1164,12 @@ impl Child {

/// Forces the child to exit.
///
/// This is equivalent to sending a `SIGKILL` on unix platforms.
/// This is equivalent to sending a `SIGKILL` on unix platforms
/// followed by [`wait`](Child::wait).
///
/// Note: std version of [`Child::kill`](std::process::Child::kill) does not `wait`.
/// For an equivalent of `Child::kill` in the standard library,
/// use [`start_kill`](Child::start_kill).
///
/// # Examples
///
Expand Down

0 comments on commit f0eda26

Please sign in to comment.