waitProcs

fnbool waitProcs(Process[] procs, Duration timeout = Duration.max, out Process[] gone, out Process[] alive) @safe

Waits for multiple processes to terminate.

This function waits for a collection of processes to terminate, with an optional timeout.

Parameters

procsArray of Process objects to wait for.
timeoutMaximum duration to wait (default is infinite).
goneOutput parameter for processes that have terminated.
aliveOutput parameter for processes that are still running.

Returns

true if all processes have terminated, false if timeout occurred.

Example:

auto proc1 = new Process(1234);
auto proc2 = new Process(5678);
Process[] gone;
Process[] alive;
bool allTerminated = waitProcs([proc1, proc2], 5.seconds, gone, alive);