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

Implement From<OwnedFd/Handle> for ChildStdin/out/err object #98704

Merged
merged 3 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add doc on From<OwnedFd/Handle> impl for ChildStd*
  • Loading branch information
vthib committed May 30, 2023
commit 9de32a7a3b7928b3679118cf423fd69246de8784
12 changes: 12 additions & 0 deletions library/std/src/os/unix/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,10 @@ impl From<crate::process::ChildStdin> for OwnedFd {
}
}

/// Create a `ChildStdin` from the provided `OwnedFd`.
///
/// The provided file descriptor must point to a pipe
/// with the `CLOEXEC` flag set.
#[stable(feature = "io_safety", since = "1.63.0")]
impl From<OwnedFd> for process::ChildStdin {
#[inline]
Expand All @@ -460,6 +464,10 @@ impl From<crate::process::ChildStdout> for OwnedFd {
}
}

/// Create a `ChildStdout` from the provided `OwnedFd`.
///
/// The provided file descriptor must point to a pipe
/// with the `CLOEXEC` flag set.
#[stable(feature = "io_safety", since = "1.63.0")]
impl From<OwnedFd> for process::ChildStdout {
#[inline]
Expand All @@ -486,6 +494,10 @@ impl From<crate::process::ChildStderr> for OwnedFd {
}
}

/// Create a `ChildStderr` from the provided `OwnedFd`.
///
/// The provided file descriptor must point to a pipe
/// with the `CLOEXEC` flag set.
#[stable(feature = "io_safety", since = "1.63.0")]
impl From<OwnedFd> for process::ChildStderr {
#[inline]
Expand Down
12 changes: 12 additions & 0 deletions library/std/src/os/windows/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ impl IntoRawHandle for process::ChildStderr {
}
}

/// Create a `ChildStdin` from the provided `OwnedHandle`.
///
/// The provided handle must be asynchronous, as reading and
/// writing from and to it is implemented using asynchronous APIs.
#[stable(feature = "io_safety", since = "1.63.0")]
impl From<OwnedHandle> for process::ChildStdin {
fn from(handle: OwnedHandle) -> process::ChildStdin {
Expand All @@ -115,6 +119,10 @@ impl From<OwnedHandle> for process::ChildStdin {
}
}

/// Create a `ChildStdout` from the provided `OwnedHandle`.
///
/// The provided handle must be asynchronous, as reading and
/// writing from and to it is implemented using asynchronous APIs.
#[stable(feature = "io_safety", since = "1.63.0")]
impl From<OwnedHandle> for process::ChildStdout {
fn from(handle: OwnedHandle) -> process::ChildStdout {
Expand All @@ -124,6 +132,10 @@ impl From<OwnedHandle> for process::ChildStdout {
}
}

/// Create a `ChildStderr` from the provided `OwnedHandle`.
///
/// The provided handle must be asynchronous, as reading and
/// writing from and to it is implemented using asynchronous APIs.
#[stable(feature = "io_safety", since = "1.63.0")]
impl From<OwnedHandle> for process::ChildStderr {
fn from(handle: OwnedHandle) -> process::ChildStderr {
Expand Down