Skip to content

Consider adding #[must_use] to std::process::Child #70186

Open
@DenSA-Inc

Description

@DenSA-Inc

I fixed a bug that was caused by not calling .wait() on a std::process::Child. See the issue for the details. I'm not exactly sure how the bug manifested itself, but I noticed that not waiting for the child process whose stdin or stdout is inherited from the parent process can lead to weird behavior.

That's why I suggest to add #[must_use = "this Child may still be attached to its parent process's stdin/stdout and must be handled"] to std::process::Child. Currently I can't think of a reason why someone would not use a Child and that's I think the compiler warnings on that will prevent more headaches than they will cause.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-processArea: `std::process` and `std::env`C-enhancementCategory: An issue proposing an enhancement or a PR with one.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions