2 releases
0.1.1 | Apr 13, 2024 |
---|---|
0.1.0 | Jan 2, 2024 |
#56 in #command-output
6KB
78 lines
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);
}
Dependencies
~0.9–1.6MB
~35K SLoC