pub struct CaptureSingle<S: StreamMarker> { /* private fields */ }Expand description
Builder for capturing a single stream from a command.
The type parameter S indicates which stream is being captured:
Stdout or Stderr.
Implementations§
Source§impl<S: StreamMarker> CaptureSingle<S>
impl<S: StreamMarker> CaptureSingle<S>
Sourcepub fn accept_nonzero_exit(self) -> Self
pub fn accept_nonzero_exit(self) -> Self
Accept non-zero exit status instead of treating it as an error.
Source§impl CaptureSingle<Stdout>
impl CaptureSingle<Stdout>
Sourcepub fn stderr_capture(self) -> CaptureAll
pub fn stderr_capture(self) -> CaptureAll
Also capture stderr, transitioning to CaptureAll.
Sourcepub fn stderr_null(self) -> Self
pub fn stderr_null(self) -> Self
Redirect stderr to /dev/null.
Sourcepub fn stderr_inherit(self) -> Self
pub fn stderr_inherit(self) -> Self
Inherit stderr from the parent process (default).
Sourcepub fn stdout_null(self) -> Command
pub fn stdout_null(self) -> Command
Stop capturing stdout (null), transitioning back to Command.
Sourcepub fn stdout_inherit(self) -> Command
pub fn stdout_inherit(self) -> Command
Stop capturing stdout (inherit), transitioning back to Command.
Sourcepub async fn run(self) -> Result<CaptureSingleResult, CommandError>
pub async fn run(self) -> Result<CaptureSingleResult, CommandError>
Execute the command and return captured stdout.
Sourcepub async fn bytes(self) -> Result<Vec<u8>, CommandError>
pub async fn bytes(self) -> Result<Vec<u8>, CommandError>
Execute the command and return captured stdout as bytes.
Sourcepub async fn string(self) -> Result<String, CommandError>
pub async fn string(self) -> Result<String, CommandError>
Execute the command and return captured stdout as a UTF-8 string.
Source§impl CaptureSingle<Stderr>
impl CaptureSingle<Stderr>
Sourcepub fn stdout_capture(self) -> CaptureAll
pub fn stdout_capture(self) -> CaptureAll
Also capture stdout, transitioning to CaptureAll.
Sourcepub fn stdout_null(self) -> Self
pub fn stdout_null(self) -> Self
Redirect stdout to /dev/null.
Sourcepub fn stdout_inherit(self) -> Self
pub fn stdout_inherit(self) -> Self
Inherit stdout from the parent process (default).
Sourcepub fn stderr_null(self) -> Command
pub fn stderr_null(self) -> Command
Stop capturing stderr (null), transitioning back to Command.
Sourcepub fn stderr_inherit(self) -> Command
pub fn stderr_inherit(self) -> Command
Stop capturing stderr (inherit), transitioning back to Command.
Sourcepub async fn run(self) -> Result<CaptureSingleResult, CommandError>
pub async fn run(self) -> Result<CaptureSingleResult, CommandError>
Execute the command and return captured stderr.
Sourcepub async fn bytes(self) -> Result<Vec<u8>, CommandError>
pub async fn bytes(self) -> Result<Vec<u8>, CommandError>
Execute the command and return captured stderr as bytes.
Sourcepub async fn string(self) -> Result<String, CommandError>
pub async fn string(self) -> Result<String, CommandError>
Execute the command and return captured stderr as a UTF-8 string.