Implement AsRawHandle on Child
passcod opened this issue · comments
Just did it for Tokio: tokio-rs/tokio#3987
While on Unix, having the PID (via Child::id()
) is sufficient, on Windows only the handle returned by the process creation has full privileges over the process. As such, it's helpful to implement AsRawHandle
for Child
.
My immediate usecase is to build up a smol/async-process variant in https://github.com/watchexec/command-group, which supports an async refactor of Cargo Watch. I'm probably going to go with Tokio for that, but for completeness and for other projects which already use async-std I'd love to add an implementation. To do process groups on Windows I use JobObjects, and assign the process handle to the job.
I'm happy to make a PR for it if you approve :)
It seems to make sense. I would accept PR to add this.