ChildStderr in std::process - Rust (original) (raw)

Struct ChildStderr

1.0.0 · Source

pub struct ChildStderr { /* private fields */ }

Expand description

A handle to a child process’s stderr.

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.

1.63.0 · Source§

Available on Unix only.

1.63.0 · Source§

Available on Windows only.

1.2.0 · Source§

Available on Unix only.

1.2.0 · Source§

Available on Windows only.

1.16.0 · Source§

1.63.0 · Source§

Available on Unix only.

1.63.0 · Source§

Available on Windows only.

1.20.0 · Source§

Source§

Converts a ChildStderr into a Stdio.

§Examples
use std::process::{Command, Stdio};

let reverse = Command::new("rev")
    .arg("non_existing_file.txt")
    .stderr(Stdio::piped())
    .spawn()
    .expect("failed reverse command");

let cat = Command::new("cat")
    .arg("-")
    .stdin(reverse.stderr.unwrap()) // Converted into a Stdio here
    .output()
    .expect("failed echo command");

assert_eq!(
    String::from_utf8_lossy(&cat.stdout),
    "rev: cannot open non_existing_file.txt: No such file or directory\n"
);

1.74.0 · Source§

Available on Unix only.

Creates a ChildStderr from the provided OwnedFd.

The provided file descriptor must point to a pipe with the CLOEXEC flag set.

Source§

Converts to this type from the input type.

1.74.0 · Source§

Available on Windows only.

Creates 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.

Source§

Converts to this type from the input type.

1.4.0 · Source§

Available on Unix only.

Source§

Consumes this object, returning the raw underlying file descriptor. Read more

1.4.0 · Source§

Available on Windows only.

1.0.0 · Source§

Source§

Pull some bytes from this source into the specified buffer, returning how many bytes were read. Read more

Source§

🔬This is a nightly-only experimental API. (read_buf #78485)

Pull some bytes from this source into the specified buffer. Read more

Source§

Like read, except that it reads into a slice of buffers. Read more

Source§

🔬This is a nightly-only experimental API. (can_vector #69941)

Determines if this Reader has an efficient read_vectoredimplementation. Read more

Source§

Reads all bytes until EOF in this source, placing them into buf. Read more

1.0.0 · Source§

Reads all bytes until EOF in this source, appending them to buf. Read more

1.6.0 · Source§

Reads the exact number of bytes required to fill buf. Read more

Source§

🔬This is a nightly-only experimental API. (read_buf #78485)

Reads the exact number of bytes required to fill cursor. Read more

1.0.0 · Source§

Creates a “by reference” adaptor for this instance of Read. Read more

1.0.0 · Source§

Transforms this Read instance to an Iterator over its bytes. Read more

1.0.0 · Source§

Creates an adapter which will chain this stream with another. Read more

1.0.0 · Source§

Creates an adapter which will read at most limit bytes from it. Read more

§

§

§

§

§

§