Description
Location
https://doc.rust-lang.org/std/process/struct.Child.html#method.kill
Summary
Documentation for Child::kill
in standard library should include a note that the signal won't be sent to any children of the process, only to the process itself (at least on Linux).
This can be confusing because people might expect that Child::kill
will terminate the process completely, including it's children.
I think the proper way to kill the process and it's children is to send the signal to the process group
https://linux.die.net/man/2/killpg
https://linux.die.net/man/2/kill
Edit: Standard library includes Command::process_group method. .process_group(0)
will set child's process group to it's PID. After spawning the command, it will be possible to call kill(-pid, SIGKILL)
, which will terminate the child and all it's children