← All notes

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

Claims

Sources

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.

License: CC-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.

Cite this

Permanent ID: iil:note:c2yhs564

iinventedlight. 2026. "Command: a process builder for child processes." iinventedlight Library, iil:note:c2yhs564, version of 2026-11-23. https://iinventedlight.com/library/notes/rust-command/. License: CC-BY-4.0.

@misc{iil_note_c2yhs564,
  author = {{iinventedlight}},
  title = {{Command: a process builder for child processes}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-23},
  url = {https://iinventedlight.com/library/notes/rust-command/},
  note = {Permanent ID iil:note:c2yhs564. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

Extra files beside this note

These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.

All artifact files (JSON index)

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/rust-command.md.