Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
DenSA-Inc opened this issue Mar 20, 2020 · 0 comments
Open

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

DenSA-Inc opened this issue Mar 20, 2020 · 0 comments
Labels
A-process Area: `std::process` and `std::env` C-enhancement Category: An issue proposing an enhancement or a PR with one. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@DenSA-Inc
Copy link

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.

@jonas-schievink jonas-schievink added C-enhancement Category: An issue proposing an enhancement or a PR with one. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Mar 20, 2020
ijackson added a commit to ijackson/rust that referenced this issue Jan 28, 2021
See rust-lang#70186 which makes the point about io handles.

Signed-off-by: Ian Jackson <[email protected]>
ijackson added a commit to ijackson/rust that referenced this issue Jan 28, 2021
Simply dropping this is usually a bad idea, for the reasons
extensively discussed in the documentation.

Closes: rust-lang#70186
Signed-off-by: Ian Jackson <[email protected]>
@workingjubilee workingjubilee added the A-process Area: `std::process` and `std::env` label Jul 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-process Area: `std::process` and `std::env` C-enhancement Category: An issue proposing an enhancement or a PR with one. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants