Files
rust/library/std
Jonathan Brouwer 117bc47981 Rollup merge of #157360 - sanidhyasin:document-command-spawn-errors, r=LawnGnome
Document error conditions for `Command::{spawn, output, status}`

Fixes rust-lang/rust#150361.

`Command::spawn`, `Command::output`, and `Command::status` all return `io::Result`, but the docs never explain *why* they can fail, and they do not mention the (easy to get wrong) distinction between a failure to spawn and a child that runs but exits unsuccessfully or is killed by a signal.

This adds an `# Errors` section to each method:

- **`spawn`** describes the common reasons spawning fails — the program not being found, lacking permission to execute it (e.g. not executable, or blocked by a policy such as `seccomp`), and the OS being unable to create the process due to resource exhaustion. It also clarifies that an error is only returned for failures *while spawning*; once the child has started, anything that happens to it (including signals) is reported through its `ExitStatus`.
- **`output`** and **`status`** refer back to `spawn` for the spawn failures, and explicitly note that a child which exits unsuccessfully or is terminated by a signal is **not** an error — they still return `Ok`, with the outcome reflected in the resulting `ExitStatus`.

The error conditions and the signal/`ExitStatus` behavior were confirmed by `@bjorn3` in the issue discussion.

Docs-only change; no code blocks were added or modified, and all intra-doc links (`io::Error`, `ExitStatus`, `Output`, `spawn`) follow link patterns already used in this module.

r? libs
2026-06-05 10:58:53 +02:00
..
2026-03-14 17:54:19 +05:30