public function exec($command)
    {
        if ( ! ($stream = ssh2_exec($this->connection, $command))) {

            throw new Ssh2CommandException("Exec failed: '{$command}'.");
        }

        stream_set_blocking($stream, true);

        $data = '';

        while ($buf = fread($stream, 4096)) {

            $data .= $buf;
        }

        fclose($stream);

        return $data;
    }
public function exec($command)
    {
        if ( ! ($stream = ssh2_exec($this->connection, $command))) {

            throw new Ssh2CommandException("Exec failed: '{$command}'.");
        }

        stream_set_blocking($stream, true);

        $data = '';

        while ($buf = fread($stream, 4096)) {

            $data .= $buf;
        }

        fclose($stream);

        return $data;
    }
public function exec ( $ command ) { if ( ! ( $ stream = ssh2_exec ( $ this -> connection , $ command ) ) ) { throw new Ssh2CommandException ( "Exec failed: '{$command}'." ) ; } stream_set_blocking ( $ stream , true ) ; $ data = '' ; while ( $ buf = fread ( $ stream , 4096 ) ) { $ data .= $ buf ; } fclose ( $ stream ) ; return $ data ; }
Executes command over connection

@param  string $command
@return mixed
@throws Ssh2CommandException
Executes command over connection