Exec ssh command on server.

@param $command
@param $server
@return string
968988
protected function execSSH($command, $server = null)
    {
        $server = $server ? $server : $this->hostNameForConfigFile();

        $ssh_config_file = $_SERVER['HOME'] . '/.ssh/config';
        $full_command = "ssh -F $ssh_config_file -t $server '$command'";
        $this->info($full_command);
        return shell_exec($full_command);
    }
788282
private function executeCommand(Server $server)
    {
        $cmd = [
            'createIndexes' => $this->collectionName,
            'indexes' => $this->indexes,
        ];

        if (isset($this->options['maxTimeMS'])) {
            $cmd['maxTimeMS'] = $this->options['maxTimeMS'];
        }

        $server->executeWriteCommand($this->databaseName, new Command($cmd), $this->createOptions());
    }
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;
    }
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);
    }
22803
public function exec($command) {
		$this->connectIfNeeded();
		$this->param = "SITE EXEC " . $command;
		$exec = true;

		if (!ftp_exec($this->handle, substr($command, strlen("SITE EXEC")))) {
			throw new FtpException(
				Yii::t('gftp', 'Could not execute command "{command}" on "{host}"', [
					'host' => $this->host, '{command}' => $this->param
				])
			);
		}
	}
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);
    }
911316
public function exec($command, array $parameters = [])
    {
        if (count($parameters)) {
            $command .= ' '.$this->compileParameters($parameters);
        }

        $this->events[] = $event = new Event($this->eventMutex, $command);

        return $event;
    }
1058912
public function command($command, array $parameters = array())
    {
        $binary = ProcessUtils::escapeArgument((new PhpExecutableFinder)->find(false));

        if (defined('HHVM_VERSION')) {
            $binary .= ' --php';
        }

        if (defined('FORGE_BINARY')) {
            $forge = ProcessUtils::escapeArgument(FORGE_BINARY);
        } else {
            $forge = 'forge';
        }

        return $this->exec("{$binary} {$forge} {$command}", $parameters);
    }
463404
private function run (string $command) : ?string
    {
        $result = \trim(\shell_exec($command) ?? "");

        return "" !== $result
            ? $result
            : null;
    }
1262293
public function execute($command)
    {
        $validator = $this->translator->toValidator($command);

        if (class_exists($validator)) {
            $this->app->make($validator)->validate($command);
        }

        return $this->bus->execute($command);
    }
318589
private function exec($command, $params = []) {
        if (in_array($command, $this->available_commands)) {
            // convert json to array then get the last messages info
            $output = json_decode($this->curl_get_contents($this->api . '/' . $command, $params), true);

            return $this->convertToObject($output);
        } else {
            echo 'command not found';
        }
    }
488437
def ssh(self, *command):
        """"""
        if self.args.user:
            ssh_spec = '{0}@{1}'.format(self.args.user, self.args.server)
        else:
            ssh_spec = self.args.server

        return self.sh('ssh', ssh_spec, *command)
94018
protected function executeCommand($command)
    {
        $result = @exec($command, $output, $code);
        $output = implode("\n", $output);

        if ($result === false) {
            throw new Exception("Failed to execute command '$command' with message: [$code] '$output'");
        }

        return $output;
    }
1059314
public function run($commands, $callback = null)
	{
		if (!$this->ssh->isConnected())
			throw new NotConnectedException();

		if (is_array($commands))
			$commands = implode(' && ', $commands);

		if ($callback === null)
			$output = '';

		$this->ssh->exec($commands, false);

		while (true) {
			if (is_null($line = $this->readLine())) break;

			if ($callback === null)
				$output .= $line;
			else
				call_user_func($callback, $line, $this);
		}

		if ($callback === null)
			return $output;
		else
			return null;
	}
172215
private function exec($command, $background = false) {

		exec(escapeshellcmd($command) . ($background === true ?  ' > /dev/null &' : ''), $output);

		return $output;
	}
1239176
def exec!(command, opts = {}, &block)
      $stdout.puts(command.to_s.blue) if verbose
      @ssh.exec! command, &block
    end
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;
    }