mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-12 00:00:12 +02:00
b7846a4e2f41cfe38889aae4a3ffdf313913d482
tokio-process
An implementation of process management for Tokio
Usage
First, add this to your Cargo.toml:
[dependencies]
tokio-process = "0.2"
Next you can use this in conjunction with the tokio and futures crates:
use std::process::Command;
use futures::Future;
use tokio_process::CommandExt;
fn main() {
// Use the standard library's `Command` type to build a process and
// then execute it via the `CommandExt` trait.
let child = Command::new("echo").arg("hello").arg("world").spawn_async();
// Make sure our child succeeded in spawning and process the result
let future = child
.expect("failed to spawn")
.map(|status| println!("exit status: {}", status))
.map_err(|e| panic!("failed to wait for exit: {}", e));
// Send the future to the tokio runtime for execution
tokio::run(future)
}
License
This project is licensed under the MIT license.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Tokio by you, shall be licensed as MIT, without any additional terms or conditions.
Languages
Rust
100%