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

allow waiting on process exit without requiring a mutable borrow and without dropping stdin #19

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

doy
Copy link
Contributor

@doy doy commented Dec 23, 2021

in an async program, it is pretty common to want to be able to wait on something like read.or(write).or(exit), which isn't actually possible with the current api, since calling status closes stdin, and also requires exclusive access to the child. this kind of structure avoids the deadlock issues that wait in the standard library has, and so the decision to close stdin makes a bit less sense.

i added this as a new method to avoid breaking the api, but i would also not be opposed to just changing the semantics of the existing status method. alternate names for status_no_drop would also be good (i couldn't think of anything off the top of my head).

doy added 2 commits December 22, 2021 20:20
it doesn't need exclusive access
this is a much more useful capability for an async process library,
since it is much easier to avoid blocking on this call (since it is a
future)
@doy
Copy link
Contributor Author

doy commented Feb 8, 2022

hey, i was just curious what the status of this was - is there anything i can do to help get it merged?

@taiki-e
Copy link
Collaborator

taiki-e commented Jul 7, 2022

Thanks for the PR and sorry for the late response. I'm not sure what a good API is to support this (I feel *_no_drop does not sufficiently explain what it does). How does tokio or any other library handle this pattern?

@taiki-e
Copy link
Collaborator

taiki-e commented Jul 7, 2022

Also, the signature change of try_status is a breaking change for users who use .as_mut().map(Child::try_status) on Option<Child> or cast Child::try_status as fn(&mut Child) -> ....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants