-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add documentation to process::Child fields #3437
Conversation
tokio/src/process/mod.rs
Outdated
/// ```compile_fail,E0425 | ||
/// let stdin = child.stdin.take().unwrap(); | ||
/// ``` |
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.
Let's not have tests that fail to compile.
/// ```compile_fail,E0425 | |
/// let stdin = child.stdin.take().unwrap(); | |
/// ``` | |
/// ```no_run | |
/// # let child: tokio::process::Child = unreachable!(); | |
/// let stdin = child.stdin.take().unwrap(); | |
/// ``` |
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.
Using the code suggested errors because the second line in unreachable, what do prefer to do? Set it to ignore
rather than no_run
?
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.
Just throw in some dummy command instead.
let child = tokio::process::Command::new("echo").spawn().unwrap();
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.
5caea6a
to
6a75db7
Compare
Co-authored-by: Alice Ryhl <alice@ryhl.io>
6a75db7
to
ee33602
Compare
Motivation
I was using
tokio::process::Child
without much experience ofstd::process::Child
and was reading the tokio docs. I worked out that I needed to use thechild.stdin.take().unwrap()
pattern but it would have saved me some time if it was in the docs. I later discovered that this was added to the rust std lib documentation by rust-lang/rust#74192.Solution
Updated the doc comments on the public fields of
Child
to match the changes made by rust-lang/rust#74192.