async-process
async-process copied to clipboard
allow waiting on process exit without requiring a mutable borrow and without dropping stdin
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).
hey, i was just curious what the status of this was - is there anything i can do to help get it merged?
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?
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) -> ....