src/main/php/Executor.php
public function outputOf(string $command, string $redirect = '2>&1')
    {
        $pd = $this->runCommand($command, $redirect);
        while (!feof($pd) && false !== ($line = fgets($pd, 4096))) {
            yield rtrim($line);
        }

        $returnCode = pclose($pd);
        if (0 != $returnCode) {
            throw new \RuntimeException(
                    'Executing command "' . $command . '"'
                    . ' failed: #' . $returnCode
            );
        }
    }
public function outputOf(string $command, string $redirect = '2>&1')
    {
        $pd = $this->runCommand($command, $redirect);
        while (!feof($pd) && false !== ($line = fgets($pd, 4096))) {
            yield rtrim($line);
        }

        $returnCode = pclose($pd);
        if (0 != $returnCode) {
            throw new \RuntimeException(
                    'Executing command "' . $command . '"'
                    . ' failed: #' . $returnCode
            );
        }
    }
public function outputOf ( string $ command , string $ redirect = '2>&1' ) { $ pd = $ this -> runCommand ( $ command , $ redirect ) ; while ( ! feof ( $ pd ) && false !== ( $ line = fgets ( $ pd , 4096 ) ) ) { yield rtrim ( $ line ) ; } $ returnCode = pclose ( $ pd ) ; if ( 0 != $ returnCode ) { throw new \ RuntimeException ( 'Executing command "' . $ command . '"' . ' failed: #' . $ returnCode ) ; } }
returns output from a command as it occurs

@param   string  $command
@param   string  $redirect  optional  how to redirect error output
@return  \Generator
@since   6.0.0
returns output from a command as it occurs