ChildExt

Trait ChildExt 

pub trait ChildExt {
    // Required methods
    fn wait_with_logging(
        self,
        target: &str,
        stdout_level: Option<Level>,
        stderr_level: Option<Level>,
    ) -> impl Future<Output = Result<ExitStatus, Error>>;
    fn wait_with_output_with_logging(
        self,
        target: &str,
        stdout_level: Option<Level>,
        stderr_level: Option<Level>,
    ) -> impl Future<Output = Result<Output, Error>>;
}
Available on crate feature process only.
Expand description

Extensions for tokio::process::Child.

Required Methods§

Source

fn wait_with_logging( self, target: &str, stdout_level: Option<Level>, stderr_level: Option<Level>, ) -> impl Future<Output = Result<ExitStatus, Error>>

Waits for the child process to exit while redirecting its output to log.

stdout_level and stderr_level specify the log level to use for the respective streams and if None, the stream will not be redirected. The respective streams must be set to Stdio::piped before spawning the child.

Source

fn wait_with_output_with_logging( self, target: &str, stdout_level: Option<Level>, stderr_level: Option<Level>, ) -> impl Future<Output = Result<Output, Error>>

Waits for the child process to exit while collecting or redirecting its output.

If stdout_level or stderr_level is None, the respective stream is collected. If a level is set to Some(_), its field in the Output will be None. The respective streams must be set to Stdio::piped before spawning the child.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§