---
source: https://iinventedlight.com/library/notes/rust-command.md
title: "Command: a process builder for child processes"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "MIT OR Apache-2.0 (Rust Standard Library); MIT OR Apache-2.0 (Rust By Example); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: Rust Standard Library, std::process; Rust By Example, Child processes. MIT OR Apache-2.0 (https://raw.githubusercontent.com/rust-lang/rust/master/COPYRIGHT). Copyright the Rust Project Developers. MIT OR Apache-2.0 (https://raw.githubusercontent.com/rust-lang/rust-by-example/master/LICENSE-MIT). Copyright the Rust Project Developers."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-23
status: published
approved_by: "Cole Withington, 2026-11-27 14:30 PT: \"Yes, publish all of that now\""
checked_on: 2026-11-23
as_of: 2026-11-23
confidence: medium
untested: "Not reproduced (2026-11-23). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-systems: rust-command"
tags: [rust, process, command, child, std]
client: Librarian
sources:
  - id: S1
    title: "std::process"
    publisher: Rust Standard Library
    url: https://doc.rust-lang.org/std/process/index.html
    accessed: 2026-11-23
    license: "MIT OR Apache-2.0"
  - id: S2
    title: "Child processes"
    publisher: Rust By Example
    url: https://doc.rust-lang.org/rust-by-example/std_misc/process.html
    accessed: 2026-11-23
    license: "MIT OR Apache-2.0"
---
# Command: a process builder for child processes
**Answer:** Command is a process builder. It gives fine-grained control over how a new process is spawned. Output is the output of a finished process. Child is a representation of a running or exited child process. wait will return a process::ExitStatus.

## Building and spawning

Command is a process builder, providing fine-grained control over how a new process should be spawned.

Output is what you get after a process has finished.

Child is a representation of a running or exited child process.

Stdio says what should happen to a standard I/O stream when you pass it to Command's stdin, stdout, or stderr methods.

ExitStatus describes the result of a process after it has terminated.

## Output, pipes, and wait

In Rust by Example, Output is the output of a finished child, and Command is the builder.

Child also exposes stdin, stdout, and stderr so you can talk to the process through pipes.

Those handles have type Option, so you unwrap them when you know a pipe is present.

To wait until a Child finishes, call Child::wait, which yields a process::ExitStatus.

## See also

- [rust-env](https://iinventedlight.com/library/notes/rust-env/)
- [rust-path](https://iinventedlight.com/library/notes/rust-path/)

## Claims

- id: C1
  claim: Command is a process builder for spawning a new process.
  source: S1
  evidence: "process builder, providing fine-grained control"

- id: C2
  claim: Output holds the output of a finished process.
  source: S1
  evidence: "output of a finished process"

- id: C3
  claim: ExitStatus describes the result after termination.
  source: S1
  evidence: "after it has terminated"

- id: C4
  claim: Command is a process builder.
  source: S2
  evidence: "is a process builder"

- id: C5
  claim: Child exposes stdin, stdout, and stderr as pipes.
  source: S2
  evidence: "via pipes"

- id: C6
  claim: Child::wait returns an ExitStatus.
  source: S2
  evidence: "Child::wait"

## Sources

- [S1] std::process. Rust Standard Library. https://doc.rust-lang.org/std/process/index.html . License: MIT OR Apache-2.0. Accessed 2026-11-23.

- [S2] Child processes. Rust By Example. https://doc.rust-lang.org/rust-by-example/std_misc/process.html . License: MIT OR Apache-2.0. Accessed 2026-11-23.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Rust Standard Library, std::process; Rust By Example, Child processes. MIT OR Apache-2.0 (https://raw.githubusercontent.com/rust-lang/rust/master/COPYRIGHT). Copyright the Rust Project Developers. MIT OR Apache-2.0 (https://raw.githubusercontent.com/rust-lang/rust-by-example/master/LICENSE-MIT). Copyright the Rust Project Developers. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
