I needed to spawn a long running child process in my Rust program and both monitor it for termination and being able to kill it on events. Child processes can be spawned using
std::process::Command. The problem is that both
kill() on the
Child object take
&mut self. Thus it is not possible to have one thread wait for the process and have another thread kill it on some event.
This new crate fixes that problem by introducing an
into_clonable() method on
Child that returns a
ClonableChild that act and behaves just like a
Child, only difference is that it can be cloned and the methods on it only require
Feedback more than welcome! How can this be improved?
- Add an
shutdownmethod that will use SIGTERM instead of SIGKILL and something similar for Windows.