Skip to content

Command::status method doesn't say when it will return an Err(...) #108213

Closed

Description

@yaymukund

Location

rustdocs for std

Summary

I think the following methods:

Command::spawn(&mut self)
Command::output(&mut self)
Command::status(&mut self)
Child::wait(&mut self)
Child::try_wait(&mut self)
Child::wait_with_output(self)

ought to mention when they will exit with an Err(_). From a discussion in the community Discord:

"nils, supposedly one of the many: they will error when the command is not found
nils, supposedly one of the many: well
nils, supposedly one of the many: there are probably other conditions than "command not found"
nils, supposedly one of the many: just in general when it failed to spawn it
nils, supposedly one of the many: which can happen for all kinds of issues"

Maybe it should be a module level doc to avoid duplication.

Activity

  1. added
    A-docs
    on Feb 18, 2023
  2. added
    A-process
    on Feb 18, 2023
  3. added
    T-libs-api
    on Feb 19, 2023
  4. jyn514 commented on Feb 19, 2023

    @jyn514
    Member

    This is platform-specific so I don't think we should document it in detail. Here is the canonical list for linux: https://man7.org/linux/man-pages/man3/posix_spawn.3.html#ERRORS, which delegates to the fork and clone man pages: https://man7.org/linux/man-pages/man2/clone.2.html#ERRORS, https://man7.org/linux/man-pages/man2/fork.2.html#ERRORS. Things like

    EAGAIN The caller is operating under the SCHED_DEADLINE
                  scheduling policy and does not have the reset-on-fork flag
                  set.  See [sched(7)](https://man7.org/linux/man-pages/man7/sched.7.html).
    

    definitely don't seem like something we want to guarantee, but something like this seems ok:


    Spawning a command returns an error if:

    • The command does not exist, or is not in the platform-specific PATH search list.
    • A platform-specific limit on memory, number of processes, or number of threads is reached.
    • A dynamic library required by the command could not be found.
  5. added
    T-libs
    and removed
    T-libs-api
    on Aug 12, 2026
  6. MarioIlRosso commented on Nov 14, 2026

    @MarioIlRosso
    Contributor

    @rustbot claim

  7. added a commit that references this issue on Nov 17, 2026
  8. added a commit that references this issue on Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-docsA-processT-libs

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions