I have the following program taken from the Rust docs for std::process::Command. It stops working after some iterations.
use std::process::Command;
use std::pro
If you read the paragraph immediately after the one you have quoted:
Calling
wait
(or other functions that wrap around it) will make the parent process wait until the child has actually exited before continuing.
In order to call wait
, you need to not move stdout
out of Child
:
let echo_out = echo_child.stdout.take().expect("failed to open 'echo' stdout");
// ...
echo_child.wait().expect("Couldn't wait for echo child");
See also: