protected function exec($cmd)
    {
        if (false === $stream = ssh2_exec($this->con, $cmd)) {
            throw new SshException(sprintf('"%s" : SSH command failed', $cmd));
        }

        stream_set_blocking($stream, true);

        $data = '';
        while ($buf = fread($stream, 4096)) {
            $data .= $buf;
        }

        fclose($stream);

        return $data;
    }
protected function exec($cmd)
    {
        if (false === $stream = ssh2_exec($this->con, $cmd)) {
            throw new SshException(sprintf('"%s" : SSH command failed', $cmd));
        }

        stream_set_blocking($stream, true);

        $data = '';
        while ($buf = fread($stream, 4096)) {
            $data .= $buf;
        }

        fclose($stream);

        return $data;
    }
protected function exec ( $ cmd ) { if ( false === $ stream = ssh2_exec ( $ this -> con , $ cmd ) ) { throw new SshException ( sprintf ( '"%s" : SSH command failed' , $ cmd ) ) ; } stream_set_blocking ( $ stream , true ) ; $ data = '' ; while ( $ buf = fread ( $ stream , 4096 ) ) { $ data .= $ buf ; } fclose ( $ stream ) ; return $ data ; }
Execute a SSH command

@param string $cmd The SSH command

@return string The output
Execute a SSH command