public function execute($cmd, $git = true, $cwd = null)
    {
        if ($git) {
            $cmd = $this->getBinaryPath() . ' ' . $cmd;
        }
        $stream = ssh2_exec($this->resource, $cmd);
        stream_set_blocking($stream, 1);
        $data = stream_get_contents($stream);
        fclose($stream);
        // rtrim values
        $values = array_map('rtrim', explode(PHP_EOL, $data));
        $this->outputLines = $values;

        return $this;
    }
public function execute($cmd, $git = true, $cwd = null)
    {
        if ($git) {
            $cmd = $this->getBinaryPath() . ' ' . $cmd;
        }
        $stream = ssh2_exec($this->resource, $cmd);
        stream_set_blocking($stream, 1);
        $data = stream_get_contents($stream);
        fclose($stream);
        // rtrim values
        $values = array_map('rtrim', explode(PHP_EOL, $data));
        $this->outputLines = $values;

        return $this;
    }
public function execute ( $ cmd , $ git = true , $ cwd = null ) { if ( $ git ) { $ cmd = $ this -> getBinaryPath ( ) . ' ' . $ cmd ; } $ stream = ssh2_exec ( $ this -> resource , $ cmd ) ; stream_set_blocking ( $ stream , 1 ) ; $ data = stream_get_contents ( $ stream ) ; fclose ( $ stream ) ; // rtrim values $ values = array_map ( 'rtrim' , explode ( PHP_EOL , $ data ) ) ; $ this -> outputLines = $ values ; return $ this ; }
execute a command

@param string      $cmd the command
@param bool        $git prepend git to the command
@param null|string $cwd directory where the command should be executed

@return CallerInterface
execute a command