-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Open
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCS-tracking-unimplementedStatus: The feature has not been implemented.Status: The feature has not been implemented.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
Feature gate: #![feature(stdio_swap)]
This is a tracking issue for the std::os::{unix, windows}::io::StdioExt extension traits
that provide ways to redirect stdio to new file handles.
Public API
// unix
pub trait StdioExt {
fn set_fd<T: Into<OwnedFd>>(&mut self, fd: T) -> io::Result<()>;
fn replace_fd<T: Into<OwnedFd>>(&mut self, replace_with: T) -> io::Result<OwnedFd>;
fn take_fd(&mut self) -> io::Result<OwnedFd>;
}
// windows
pub trait StdioExt {
fn set_handle<T: Into<OwnedHandle>>(&mut self, handle: Option<T>) -> io::Result<()>;
fn replace_handle<T: Into<OwnedHandle>>(&mut self, replace_with: T) -> io::Result<Option<BorrowedHandle<'static>>>;
fn take_handle(&mut self) -> io::Result<Option<BorrowedHandle<'static>>>;
}Steps / History
(Remember to update the S-tracking-* label when checking boxes.)
- ACP: stdio
set,closeandtakemethods libs-team#500 - Implementation: #...
- Final comment period (FCP)1
- Stabilization PR
Unresolved Questions
- The windows API leaks the old handles handles because they're
essentiallyBorrowedHandle<'static>and might be in use by other threads.
This can lead to pipes not getting closed, which may be unexpected.
#t-libs > take, close and replace for stdio
Footnotes
tyilo and xfnw
Metadata
Metadata
Assignees
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCS-tracking-unimplementedStatus: The feature has not been implemented.Status: The feature has not been implemented.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.