cmdwrap

Crates.iocmdwrap
lib.rscmdwrap
version0.1.1
sourcesrc
created_at2024-01-02 06:34:14.67195
updated_at2024-04-13 13:09:08.340268
descriptionCommand for run shell script
homepage
repositoryhttps://github.com/prongbang/cmdwrap
max_upload_size
id1085908
size8,508
prongbang (prongbang)

documentation

README

cmdwrap

Command for run shell script.

How to use:

  • Synchronous
let command = "pwd";
match cmdwrap::run(command) {
    Ok(output) => {
        println!("{}", output)
    }
    Err(error) => {
        println!("\tCommand execution failed:\n{}", error);
    }
}
  • Asynchronous
use futures_util::pin_mut;
use futures_util::stream::StreamExt;

let command = "pwd";
let mut s = cmdwrap::run_stream(command);
pin_mut!(s); // needed for iteration
while let Some(value) = s.next().await {
    println!("{}", value.output);
}
Commit count: 12

cargo fmt