Bug 16615 – std.process is missing functionality for child processes

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-10-15T09:00:08Z
Last change time
2018-01-05T13:29:08Z
Assigned to
Eduard Staniloiu
Creator
Andre
See also
https://issues.dlang.org/show_bug.cgi?id=17479

Comments

Comment #0 by andre — 2016-10-15T09:00:08Z
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
Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/71ca4c5b1428e6b4a9b2d89586cd8851c48619a6 Partial Fix For Issue 16615 - convert os pid to std.process Pid https://github.com/dlang/phobos/commit/15a5a4898c67d0ecb7c7d2a5d9e744eeaf188ca1 Merge pull request #5086 from edi33416/process_enhancement Partial Fix Issue 16615 - convert os pid to std.process Pid merged-on-behalf-of: Andrei Alexandrescu <[email protected]>
Comment #2 by github-bugzilla — 2017-06-09T15:51:37Z
Commit pushed to revert-5086-process_enhancement at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/07602da6334fa250032d302c777b75d17b0e4379 Revert "Partial Fix Issue 16615 - convert os pid to std.process Pid"
Comment #3 by github-bugzilla — 2017-06-09T16:48:21Z
Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/07602da6334fa250032d302c777b75d17b0e4379 Revert "Partial Fix Issue 16615 - convert os pid to std.process Pid" https://github.com/dlang/phobos/commit/9bfc82130c0e4af4d1dc95bb261570c6e4f6f5d8 Merge pull request #5456 from dlang/revert-5086-process_enhancement Revert "Partial Fix Issue 16615 - convert os pid to std.process Pid" merged-on-behalf-of: Sebastian Wilzbach <[email protected]>
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
Commits pushed to stable at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/71ca4c5b1428e6b4a9b2d89586cd8851c48619a6 Partial Fix For Issue 16615 - convert os pid to std.process Pid https://github.com/dlang/phobos/commit/15a5a4898c67d0ecb7c7d2a5d9e744eeaf188ca1 Merge pull request #5086 from edi33416/process_enhancement https://github.com/dlang/phobos/commit/07602da6334fa250032d302c777b75d17b0e4379 Revert "Partial Fix Issue 16615 - convert os pid to std.process Pid" https://github.com/dlang/phobos/commit/9bfc82130c0e4af4d1dc95bb261570c6e4f6f5d8 Merge pull request #5456 from dlang/revert-5086-process_enhancement
Comment #7 by github-bugzilla — 2018-01-05T13:29:08Z
Commits pushed to dmd-cxx at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/71ca4c5b1428e6b4a9b2d89586cd8851c48619a6 Partial Fix For Issue 16615 - convert os pid to std.process Pid https://github.com/dlang/phobos/commit/15a5a4898c67d0ecb7c7d2a5d9e744eeaf188ca1 Merge pull request #5086 from edi33416/process_enhancement https://github.com/dlang/phobos/commit/07602da6334fa250032d302c777b75d17b0e4379 Revert "Partial Fix Issue 16615 - convert os pid to std.process Pid" https://github.com/dlang/phobos/commit/9bfc82130c0e4af4d1dc95bb261570c6e4f6f5d8 Merge pull request #5456 from dlang/revert-5086-process_enhancement