Executes a command on remote server.

@param string $command

@return string

@throws \BackBee\Util\Transport\Exception\TransportException Occures if SSH connection is invalid
541798
private function exec($command)
    {
        if (null === $this->_ssh_resource) {
            throw new TransportException(sprintf('None SSH connection available.'));
        }

        if (false === $stream = ssh2_exec($this->_ssh_resource, $command)) {
            throw new TransportException(sprintf('SSH command `%s` failed.', $command));
        }

        stream_set_blocking($stream, true);
        $data = "";
        while ($buf = fread($stream, 4096)) {
            $data .= $buf;
        }
        fclose($stream);

        return $data;
    }
796456
public function execute(string $command): string
    {
        $result = shell_exec($command);
        if ($result === null) {
            $result = '';
        }
        return $result;
    }
1337169
public function execute(string $command): string
    {
        return $this->shellFacade->runCommand($this->command . ' ' . $command);
    }
1020056
public function execute($command) {
    /** @var \Robo\Common\ProcessExecutor $process_executor */
    $process_executor = Robo::process(new Process($command));
    return $process_executor->dir($this->getConfigValue('repo.root'))
      ->printOutput(FALSE)
      ->printMetadata(FALSE)
      ->interactive(FALSE);
  }
37571
public function execute($command, $prompt = null)
    {
        if (!$this->socket) {
            throw new TelnetException('attempt to execute without a connection - call connect first');
        }

        $this->write($command);
        return $this->getResponse($prompt);
    }
608840
public function executeAdbShellCommand($command)
    {
        return $this->getDriver()->curl(
            $this->getDriver()->factoryCommand(
                'selendroid/adb/executeShellCommand',
                \WebDriver_Command::METHOD_POST,
                ['command' => $command]
            )
        );
    }
373328
public function exec($cmd)
    {
        
        if ($this->jumphost) {
            $cmd = "ssh " . $this->jumphost . " " . $cmd;
        }
        
        if ( ! ($stream = ssh2_exec($this->connection, $cmd))) {
            throw new \Exception('SSH command failed');
        }
        stream_set_blocking($stream, true);
        $data = "";
        while ($buf = fread($stream, 4096)) {
            $data .= $buf;
        }
        fclose($stream);
        
        return $data;
    }
342125
public function execute($command, callable $callback = null)
    {
        $this->login();

        return $this->ssh->exec(sprintf('cd %s; %s', $this->directory, $command), $callback);
    }
55171
public function run(String $command = NULL)
    {
        if( ! empty($this->connect) )
        {
            if( ! empty($this->command) )
            {
                $command = Base::removeSuffix($this->command);
            }

            $this->_defaultVariables();

            return $this->stream = ssh2_exec($this->connect, $command);
        }

        return false;
    }
1356319
public function exec($command)
    {
        // Check for prohibited commands
        foreach ($this->prohibitedCommands as $prohibitedCommand) {
            if (strpos(trim($command), $prohibitedCommand) !== false) {
                throw new \Exception('The shell command ' . $command . ' is prohibited');
            }
        }
        return exec($command);
    }
780743
public function rawcommand($command)
    {
        if (preg_match('/(.+)[\n]$/', $command)) {
            $this->socket->send($command);
        } else {
            $this->socket->send($command.PHP_EOL);
        }
    }
1077376
function runCommand(\Plasma\CommandInterface $command) {
        if($this->goingAway) {
            throw new \Plasma\Exception('Client is closing all connections');
        }
        
        $connection = $this->getOptimalConnection();
        
        try {
            return $connection->runCommand($this, $command);
        } catch (\Throwable $e) {
            $this->checkinConnection($connection);
            throw $e;
        }
    }
556952
protected function executeCommand($command)
    {

        $process = new Process($command);
        $process->run();

        return array(
            $process->getExitCode(),
            $process->getOutput(),
            $process->getErrorOutput(),
        );
    }
923478
public static function forCommand($command)
    {
        $type =  is_object($command) ? get_class($command) : gettype($command);

        $exception = new static('Could not determine command name of ' . $type);
        $exception->command = $command;

        return $exception;
    }
791129
private function executeCommand(array $parameters, string $command)
    {
        foreach ($parameters as $index => $object) {
            $parameters[$index]['command'] = $command;
        }
        $result = $this->execute($parameters);
        if (isset($index)) {
            unset($index);
        }
        if (isset($object)) {
            unset($object);
        }
        unset($parameters);
        unset($command);
        return $result;
    }
643423
protected static function execute($command)
    {
        $res = array();

        ob_start();
        passthru($command, $success);
        $output = ob_get_clean();

        foreach ((explode("\n", $output)) as $line) $res[] = trim($line);

        return array_filter($res);
    }
12748
public function sendCommand(string $command) : string
    {
        try {
            $this->socket->send(json_encode([
                'action' => 'command',
                'command' => [
                    'name' => $command,
                ]
            ]));
            $result = $this->socket->recv();
            return $result;
        } catch (\ZMQException $e) {
            throw new ClientException($e->getMessage());
        }
    }