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.
Available on Unix only.
Available on Windows only.
Available on Unix only.
Available on Windows only.
Available on Unix only.
Available on Windows only.
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"
);
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.
Converts to this type from the input type.
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.
Converts to this type from the input type.
Available on Unix only.
Consumes this object, returning the raw underlying file descriptor. Read more
Available on Windows only.
Pull some bytes from this source into the specified buffer, returning how many bytes were read. Read more
🔬This is a nightly-only experimental API. (read_buf
#78485)
Pull some bytes from this source into the specified buffer. Read more
Like read
, except that it reads into a slice of buffers. Read more
🔬This is a nightly-only experimental API. (can_vector
#69941)
Determines if this Read
er has an efficient read_vectored
implementation. Read more
Reads all bytes until EOF in this source, placing them into buf
. Read more
Reads all bytes until EOF in this source, appending them to buf
. Read more
Reads the exact number of bytes required to fill buf
. Read more
🔬This is a nightly-only experimental API. (read_buf
#78485)
Reads the exact number of bytes required to fill cursor
. Read more
Creates a “by reference” adaptor for this instance of Read
. Read more
Transforms this Read
instance to an Iterator over its bytes. Read more
Creates an adapter which will chain this stream with another. Read more
Creates an adapter which will read at most limit
bytes from it. Read more