ko-process icon indicating copy to clipboard operation
ko-process copied to clipboard

handle exit single process in pool

Open pilot114 opened this issue 4 years ago • 0 comments

$manager = new \Ko\ProcessManager();
        for ($i = 0; $i < 10; $i++) {
            $manager->fork(function(\Ko\Process $p) use ($i) {
                echo 'Hello from ' . $p->getPid();
                sleep(1);
            })->onSuccess(function() {
                echo 'end';
            })->onError(function() {
                echo 'fail end';
            });
        }
$manager->wait();

OnSuccess / onError callbacks don't work if call wait() on process manager. If call wait () for each process handles call correct, but not parallel

pilot114 avatar Mar 30 '20 12:03 pilot114