-
-
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
process: Impl {ChildStd*}::into_owned_{fd, handle}
#5899
Merged
Darksonn
merged 3 commits into
tokio-rs:master
from
NobodyXu:feat/into-owned-fd-and-handle
Aug 9, 2023
Merged
process: Impl {ChildStd*}::into_owned_{fd, handle}
#5899
Darksonn
merged 3 commits into
tokio-rs:master
from
NobodyXu:feat/into-owned-fd-and-handle
Aug 9, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NobodyXu
force-pushed
the
feat/into-owned-fd-and-handle
branch
from
July 30, 2023 12:46
bf150ff
to
491cdd6
Compare
Darksonn
added
A-tokio
Area: The main tokio crate
M-process
Module: tokio/process
labels
Jul 31, 2023
Darksonn
reviewed
Jul 31, 2023
NobodyXu
force-pushed
the
feat/into-owned-fd-and-handle
branch
from
July 31, 2023 08:10
491cdd6
to
35cb474
Compare
NobodyXu
changed the title
Impl
process: Impl Aug 1, 2023
{ChildStd*}::into_owned_{fd, handle}
{ChildStd*}::into_owned_{fd, handle}
NobodyXu
force-pushed
the
feat/into-owned-fd-and-handle
branch
2 times, most recently
from
August 4, 2023 05:17
90f463f
to
d87412d
Compare
CI failure is due to #5888 A re-run is required. |
Darksonn
reviewed
Aug 4, 2023
NobodyXu
force-pushed
the
feat/into-owned-fd-and-handle
branch
4 times, most recently
from
August 4, 2023 11:54
38f1ee1
to
ba89641
Compare
@Darksonn I've verified that the docs.rs build includes both windows and unix with features doc: |
This comment was marked as outdated.
This comment was marked as outdated.
NobodyXu
force-pushed
the
feat/into-owned-fd-and-handle
branch
3 times, most recently
from
August 6, 2023 14:14
ca14846
to
ae064a9
Compare
Fixed tokio-rs#4403 and fixed tokio-rs#5333 Signed-off-by: Jiahao XU <[email protected]>
Co-authored-by: Alice Ryhl <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
NobodyXu
force-pushed
the
feat/into-owned-fd-and-handle
branch
from
August 9, 2023 00:37
ae064a9
to
4137b6e
Compare
Darksonn
approved these changes
Aug 9, 2023
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.
Thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixed #4403 and fixed #5333
Motivation
tokio::process::ChildStd*
does not implementIntoRawFd
/IntoRawHandle
or any similar method to obtain an owned fd/handle of the child stdin/stdout/stderr.It makes sense since converting it to a raw fd/handle is fallible operation.
Solution
Implement
into_owned_fd
andinto_owned_handle
for theseChildStd*
, which returnsio::Result<Owned*>
since it is fallible.I chose to return
OwnedFd
/OwnedHandle
instead ofRawFd
/RawHandle
since the msrv has just bumped to 1.63 so we can now use these types and it is much more ergonomic than returning raw ones.