allow waiting on process exit without requiring a mutable borrow and without dropping stdin #19
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 callingstatus
closes stdin, and also requires exclusive access to the child. this kind of structure avoids the deadlock issues thatwait
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 forstatus_no_drop
would also be good (i couldn't think of anything off the top of my head).