std.process has no functionality to get the Pids of child processes. This is for example an issue if you want to use function kill to kill a process tree.
Of course you can use system specific functionality to retrieve the processIDs of the child processes, but then again you have the issue there is no function to convert a processID to a Pid, as kill expects a pid.
I would be if a function is included in std.process to kill a pid and which also kills all child processes.
In addition a function would be nice, which returns the direct child pid of a given pid.
See also forum post https://forum.dlang.org/thread/[email protected]
Comment #1 by github-bugzilla — 2017-06-08T11:04:39Z
Comment #4 by dlang-bugzilla — 2017-06-09T18:16:18Z
Resolving as WONTFIX as per https://github.com/dlang/phobos/pull/5086#issuecomment-307461557 and https://github.com/dlang/phobos/pull/5086#issuecomment-307426691 (quoting):
Although it might not be obvious, killing a process is inherently a very platform specific operation. There is and cannot be an obviously correct way to do it on both platforms (Windows and POSIX), because the two platforms manage processes in different way. Windows does not have signals; POSIX does not allow specifying exit codes; and reparenting is done differently on both.
Furthermore, the example use case presented in the issue (killing a process tree) is not possible to correctly implement with just kill - you must suspend the entire process group, and only then kill them, and I'm not sure that even that is sufficient. I would advise against attempting to do it in general, and instead run the process group in a container and kill it wholesale.
Comment #5 by dlang-bugzilla — 2017-06-11T21:46:41Z
*** Issue 17479 has been marked as a duplicate of this issue. ***
Comment #6 by github-bugzilla — 2017-06-17T11:35:08Z