Swoole\Coroutine\System::waitPid(int $pid): int | false

Declaration

<?php
Swoole\Coroutine\System::waitPid(int $pid): int | false

Parameters

pid

Linux process ID.

Return

Description

Waiting for event from the process based on PID within Coroutine.

Example

<?php
$process = new Swoole\Process(function () {
    echo "child process start\n";
    sleep(10);
    echo "child process exit\n";
});

$process->start();

Co\run(function () {
    $info = Swoole\Coroutine\System::waitPid($process->pid);
    var_dump($info);
});