public function wait($timeout = -1)
    {
        $forever = ($timeout < 0);

        while ($this->isAlive()) {
            $this->read();

            if (!$forever && (microtime(true) - $this->start > $timeout)) {
                $this->kill(SIGKILL);
                break;
            }

            usleep(5000);
        }

        $this->cleanup();
    }
public function wait($timeout = -1)
    {
        $forever = ($timeout < 0);

        while ($this->isAlive()) {
            $this->read();

            if (!$forever && (microtime(true) - $this->start > $timeout)) {
                $this->kill(SIGKILL);
                break;
            }

            usleep(5000);
        }

        $this->cleanup();
    }
public function wait ( $ timeout = - 1 ) { $ forever = ( $ timeout < 0 ) ; while ( $ this -> isAlive ( ) ) { $ this -> read ( ) ; if ( ! $ forever && ( microtime ( true ) - $ this -> start > $ timeout ) ) { $ this -> kill ( SIGKILL ) ; break ; } usleep ( 5000 ) ; } $ this -> cleanup ( ) ; }
Wait for the process to finish execution.

@param int $timeout

@throws ProcessException
Wait for the process to finish execution .