Closed oconnor663 closed 7 years ago
Or, we could provide some other way to get at ChildStdin
etc.
Or, we could say that the ChildStdin
interface doesn't work super well with sharing, because there's no try_clone
or impl Write for &ChildStdin
on it. Maybe the answer is that if you want to use those things (or wait_with_output
), you need to use os_pipe
?
Access to the underlying child is pretty unsafe, which is why we switched from new
to spawn
. No plans to expose any more of it unless someone needs us to.
A
get_child
method could return anOption<&mut Child>
or something like that. (MaybeOption<MutexGuard<Child>>
?) The contract would be that you get it out if the state isNotWaiting
orWaiting
, but not if it'sExited
, because then theChild
struct isn't valid anymore. Note that if the caller swaps out the child, it could cause really weird behavior, if we're still relying on the child'swait
method to clean up. Maybe the right thing is to stop using that API entirely, and just use the PID that we stashed at the beginning?