think\Process::wait PHP Method

wait() public method

等待要终止的进程
public wait ( callable | null $callback = null ) : integer
$callback callable | null
return integer
    public function wait($callback = null)
    {
        $this->requireProcessIsStarted(__FUNCTION__);
        $this->updateStatus(false);
        if (null !== $callback) {
            $this->callback = $this->buildCallback($callback);
        }
        do {
            $this->checkTimeout();
            $running = '\\' === DS ? $this->isRunning() : $this->processPipes->areOpen();
            $close = '\\' !== DS || !$running;
            $this->readPipes(true, $close);
        } while ($running);
        while ($this->isRunning()) {
            usleep(1000);
        }
        if ($this->processInformation['signaled'] && $this->processInformation['termsig'] !== $this->latestSignal) {
            throw new \RuntimeException(sprintf('The process has been signaled with signal "%s".', $this->processInformation['termsig']));
        }
        return $this->exitcode;
    }