Missing functionality in std.process?
Eduard Staniloiu via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Jan 6 14:32:55 PST 2017
On Friday, 14 October 2016 at 16:33:51 UTC, Andre Pany wrote:
> What I miss is s.th. to get the child Pids of a parent Pid.
> Again I can use OS dependent functionality to retrieve the
> processIDs of the children, but how to convert these processIDs
> to Pids for usage with kill/wait functions?
On Unix you could use
core.sys.posix.signal.kill(pid_t, int)
core.sys.posix.sys.wait.wait(int*)
core.sys.posix.sys.wait.waitpid(pid_t, int*, int)
I tested the kill function and it works like a charm. Since pid_t
is just an alias to int, just provide the process integer to the
function.
On Windows, I'm guessing, you could use
core.sys.windows.winbase.TerminateProcess(HANDLE, UINT)
I don't have a Windows environment set up so you will have to
play with this.
More information about the Digitalmars-d-learn
mailing list