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

Indicate how ChildStd{in,out,err} FDs are closed. #44625

Merged
merged 4 commits into from
Sep 24, 2017
Merged
Changes from 2 commits
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
34 changes: 26 additions & 8 deletions src/libstd/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,18 @@ use sys_common::{AsInner, AsInnerMut, FromInner, IntoInner};
pub struct Child {
handle: imp::Process,

/// The handle for writing to the child's stdin, if it has been captured
/// The handle for writing to the child's standard input (stdin), if it has
/// been captured.
#[stable(feature = "process", since = "1.0.0")]
pub stdin: Option<ChildStdin>,

/// The handle for reading from the child's stdout, if it has been captured
/// The handle for reading from the child's standard output (stdout), if it
/// has been captured.
#[stable(feature = "process", since = "1.0.0")]
pub stdout: Option<ChildStdout>,

/// The handle for reading from the child's stderr, if it has been captured
/// The handle for reading from the child's standard error (stderr), if it
/// has been captured.
#[stable(feature = "process", since = "1.0.0")]
pub stderr: Option<ChildStderr>,
}
Expand Down Expand Up @@ -149,12 +152,16 @@ impl fmt::Debug for Child {
}
}

/// A handle to a child process's stdin.
/// A handle to a child process's standard input (stdin).
///
/// This struct is used in the [`stdin`] field on [`Child`].
///
/// When an instance of `ChildStdin` is [dropped], the `ChildStdin`'s underlying
/// file handle will be closed.
///
/// [`Child`]: struct.Child.html
/// [`stdin`]: struct.Child.html#structfield.stdin
/// [dropped]: ../ops/trait.Drop.html
#[stable(feature = "process", since = "1.0.0")]
pub struct ChildStdin {
inner: AnonPipe
Expand Down Expand Up @@ -192,12 +199,16 @@ impl fmt::Debug for ChildStdin {
}
}

/// A handle to a child process's stdout.
/// A handle to a child process's standard output (stdout).
///
/// This struct is used in the [`stdout`] field on [`Child`].
///
/// When an instance of `ChildStdout` is [dropped], the `ChildStdout`'s
/// underlying file handle will be closed.
///
/// [`Child`]: struct.Child.html
/// [`stdout`]: struct.Child.html#structfield.stdout
/// [dropped]: ../ops/trait.Drop.html
#[stable(feature = "process", since = "1.0.0")]
pub struct ChildStdout {
inner: AnonPipe
Expand Down Expand Up @@ -239,8 +250,12 @@ impl fmt::Debug for ChildStdout {
///
/// This struct is used in the [`stderr`] field on [`Child`].
///
/// When an instance of `ChildStderr` is [dropped], the `ChildStderr`'s
/// underlying file handle will be closed.
///
/// [`Child`]: struct.Child.html
/// [`stderr`]: struct.Child.html#structfield.stderr
/// [dropped]: ../ops/trait.Drop.html
#[stable(feature = "process", since = "1.0.0")]
pub struct ChildStderr {
inner: AnonPipe
Expand Down Expand Up @@ -534,7 +549,8 @@ impl Command {
self
}

/// Configuration for the child process's stdin handle (file descriptor 0).
/// Configuration for the child process's standard input (stdin) handle
/// (file descriptor 0).
Copy link
Member

Choose a reason for hiding this comment

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

The file descriptor 0 part seems awfully platform specific.

///
/// # Examples
///
Expand All @@ -554,7 +570,8 @@ impl Command {
self
}

/// Configuration for the child process's stdout handle (file descriptor 1).
/// Configuration for the child process's standard output (stdout) handle
/// (file descriptor 1).
///
/// # Examples
///
Expand All @@ -574,7 +591,8 @@ impl Command {
self
}

/// Configuration for the child process's stderr handle (file descriptor 2).
/// Configuration for the child process's standard error (stderr) handle
/// (file descriptor 2).
///
/// # Examples
///
Expand Down