Crates.io | process-lib |
lib.rs | process-lib |
version | 1.0.0 |
source | src |
created_at | 2023-08-27 12:00:47.508675 |
updated_at | 2024-10-27 09:51:41.706567 |
description | Cross-platform, asynchronous Rust library to run commands in pipelines |
homepage | https://pimalaya.org/ |
repository | https://github.com/pimalaya/core/tree/master/process/ |
max_upload_size | |
id | 956037 |
size | 24,609 |
Cross-platform, asynchronous Rust library to run commands in pipelines.
This library can be seen as a convenient async wrapper around std::process::Command
:
sh -c
or cmd /C
The library comes with 3 cargo features, including 1 default one:
tokio
: enables the tokio async runtimeasync-std
: enables the async-std async runtimederive
: enables serde supportuse process::{Command, Pipeline};
#[tokio::main]
async fn main() {
// run a single command
let cmd = Command::new("echo hello, world!");
let out = cmd.run().await.unwrap().to_string_lossy();
assert_eq!(out, "hello, world!\n");
// run a pipeline
let cmd = Pipeline::new(["echo hello", "cat"]);
let out = cmd.run().await.unwrap().to_string_lossy();
assert_eq!(out, "hello\n");
}
See the full API documentation on docs.rs.
Special thanks to the NLnet foundation and the European Commission that helped the project to receive financial support from various programs:
If you appreciate the project, feel free to donate using one of the following providers: