No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Daniel Baumann eb8d8397be
Releasing fastforward version 2.5.0-1~ffwd13+u1.
Signed-off-by: Daniel Baumann <daniel@debian.org>
2026-01-04 12:20:14 +01:00
.github Merging upstream version 2.5.0. 2026-01-04 12:19:36 +01:00
debian Releasing fastforward version 2.5.0-1~ffwd13+u1. 2026-01-04 12:20:14 +01:00
examples Merging upstream version 2.4.0. 2026-01-04 12:18:39 +01:00
src Merging upstream version 2.5.0. 2026-01-04 12:19:36 +01:00
tests Merging upstream version 2.4.0. 2026-01-04 12:18:39 +01:00
.gitignore Adding upstream version 2.3.1. 2026-01-04 12:18:25 +01:00
Cargo.toml Merging upstream version 2.5.0. 2026-01-04 12:19:36 +01:00
CHANGELOG.md Merging upstream version 2.5.0. 2026-01-04 12:19:36 +01:00
LICENSE-APACHE Adding upstream version 2.3.1. 2026-01-04 12:18:25 +01:00
LICENSE-MIT Adding upstream version 2.3.1. 2026-01-04 12:18:25 +01:00
README.md Merging upstream version 2.4.0. 2026-01-04 12:18:39 +01:00

async-process

Build License Cargo Documentation

Async interface for working with processes.

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

Implementation

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.

Examples

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")
    .arg(".")
    .stdout(Stdio::piped())
    .spawn()?;

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

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

License

Licensed under either of

at your option.

Contribution

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.