Skip to main content

Module process

Module process 

Source
Expand description

Async child process management.

This module uses unsafe code for Unix process spawning (fork/exec) and signal handling (waitpid).

This module provides async equivalents of std::process types for spawning and managing child processes. It enables non-blocking process spawning, I/O piping, and wait operations.

§Example

use asupersync::process::Command;

fn run_command() -> std::io::Result<()> {
    let mut cmd = Command::new("echo");
    let output = cmd
        .arg("hello")
        .output()?;

    println!("stdout: {}", String::from_utf8_lossy(&output.stdout));
    Ok(())
}

§Cancel-Safety

  • Process spawning itself is synchronous (the syscall).
  • wait() can be cancelled; the process continues running.
  • Use kill_on_drop(true) for automatic cleanup on cancellation.
  • I/O operations are cancel-safe (partial reads/writes are fine).

Structs§

Child
Handle to a spawned child process.
ChildStderr
Async handle to the child’s standard error.
ChildStdin
Async handle to the child’s standard input.
ChildStdout
Async handle to the child’s standard output.
Command
Builder for spawning child processes.
ExitStatus
Exit status of a process.
Output
Collected output from a child process.

Enums§

ProcessError
Error type for process operations.
Stdio
Standard I/O configuration for child processes.