Go to file
John Nunley ed17f53035 v2.1.0
Signed-off-by: John Nunley <dev@notgull.net>
2024-02-18 08:47:04 -08:00
.github Update actions/checkout action to v4 2023-09-10 18:19:38 +09:00
examples Fix minor typo in example.rs (#40) 2023-04-07 10:14:06 -07:00
src m: Port to event-listener v5.0.0 2024-02-12 06:26:10 -08:00
tests feat: Add a way to run without the async-process thread 2023-10-10 17:47:46 -07:00
.gitignore Initial commit 2020-08-18 20:19:25 +00:00
CHANGELOG.md v2.1.0 2024-02-18 08:47:04 -08:00
Cargo.toml v2.1.0 2024-02-18 08:47:04 -08:00
LICENSE-APACHE Initial version 2020-08-19 13:34:03 +00:00
LICENSE-MIT Initial version 2020-08-19 13:34:03 +00:00
README.md Update license badge to match Cargo.toml 2021-02-14 13:38:37 +09:00



Build License Cargo Documentation

Async interface for working with processes.

This crate is an async version of std::process.


A background thread named "async-process" is lazily created on first use, which waits for spawned child processes to exit and then calls the wait() syscall to clean up the "zombie" processes. This is unlike the process API in the standard library, where dropping a running Child leaks its resources.

This crate uses async-io for async I/O on Unix-like systems and blocking for async I/O on Windows.


Spawn a process and collect its output:

use async_process::Command;

let out = Command::new("echo").arg("hello").arg("world").output().await?;
assert_eq!(out.stdout, b"hello world\n");

Read the output line-by-line as it gets produced:

use async_process::{Command, Stdio};
use futures_lite::{io::BufReader, prelude::*};

let mut child = Command::new("find")

let mut lines = BufReader::new(child.stdout.take().unwrap()).lines();

while let Some(line) = lines.next().await {
    println!("{}", line?);


Licensed under either of

at your option.


Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.