Extracted from [here](https://github.com/ocaml/dune/pull/4751#discussion_r656492007). Dune should kill the entire process group. This requires `killpg` bindings.