-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
std: Child::kill() returns error if process has already exited #49461
Conversation
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we note which error is returned, at least on common platforms, though we should indicate it's not guaranteed to be the case.
Certainly we could. Helpfully, @whimboo provided an example of such an error in https://bugzilla.mozilla.org/show_bug.cgi?id=1448900#c3. I’ve referenced When you say it is not guaranteed that it returns an error if the process has already exited, which systems are you referring to? |
I meant that the error returned today on a given system might change down the road and/or other situations could return new errors; we can't guarantee stability of underlying OS APIs. |
And do you think the amendment resolves this issue? Specifically it |
I'd rather leave that as |
Thanks for your feedback. I’ve pushed another fixup which takes that into consideration. Let me know what you think. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me with the nit fixed
src/libstd/process.rs
Outdated
/// | ||
/// [`ErrorKind`]: ../io/enum.ErrorKind.html | ||
/// [`InvalidInput`]: ../io/enum.ErrorKind.html#variant.InvalidInput | ||
/// [`Other]: ../io/enum.ErrorKind.html#variant.Other |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing a '`' on Other
Ping from triage @andreastt — you have a review comment to address! |
Sorry about that; nit addressed. |
Ping from triage @Mark-Simulacrum! The user addressed your comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me with the nit fixed
src/libstd/process.rs
Outdated
@@ -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`] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Double space after the period.
Ping from triage @Mark-Simulacrum! The user addressed your comments. |
@bors r+ rollup |
📌 Commit bc4bd56 has been approved by |
…-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.
Rollup of 11 pull requests Successful merges: - #49461 (std: Child::kill() returns error if process has already exited) - #49727 (Add Cell::update) - #49812 (Fix revision support for UI tests.) - #49829 (Add doc links to `std::os` extension traits) - #49906 (Stabilize `std::hint::unreachable_unchecked`.) - #49970 (Deprecate Read::chars and char::decode_utf8) - #49985 (don't see issue #0) - #50118 (fix search bar bug) - #50139 (encourage descriptive issue titles) - #50174 (Use FxHashMap in syntax_pos::symbol::Interner::intern.) - #50185 (core: Fix overflow in `int::mod_euc` when `self < 0 && rhs == MIN`) Failed merges:
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.