pub struct ShellTask { /* private fields */ }
Expand description

A ShellTask runs commands and provides a passthrough log handler for each log line.

Examples

use shell_candy::{Result, ShellTaskLog, ShellTask};

fn main() -> Result<()> {
  // Create a task to check the current version of `rustc` that is installed
  let task = ShellTask::new("rustc --version", |line| {
    match line {
      // print all log lines with an "info: " prefix
      ShellTaskLog::Stderr(message) | ShellTaskLog::Stdout(message) => eprintln!("info: {}", &message),
    }
  })?;

  // Run the task
  task.run()?;

  Ok(())
}

Implementations

Create a new ShellTask with a log line handler.

Run a ShellTask, applying the log handler to each line.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.