Skip to content
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

tokio-io: impl asRawFd/AsRawHandle for stdio #2335

Merged
merged 1 commit into from
Mar 23, 2020

Conversation

MarinPostma
Copy link
Contributor

fixes: #2311

provides an implementation of AsRawFd and AsRawHandle for Stdin, Stdout and Stderr to match the std counterpart behavior.

Motivation

It is sometimes necessary to manipulate stdio as raw file descriptors, to set attributes for example.

Solution

The Std* is wrapped in an Option in a Blocking, which makes it impossible to take it out in a non blocking way. I implemented it the same way Async-std did it, and retrieve another instance of std::io::Std*, and use it to retrieve an new RawFd.

Copy link
Member

@carllerche carllerche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 👍

@carllerche carllerche merged commit 2258de5 into tokio-rs:master Mar 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Proposal: allow acces to RawFd for tokio::io::Stdout
2 participants