protected function executeCommand(array $command_args)
{
$output = '';
$this->validateEnvironment($this->site, $this->environment);
if ($this->validateCommand($command_args)) {
$command_line = $this->getCommandLine($command_args);
$result = $this->environment->sendCommandViaSsh($command_line);
$output = $result['output'];
$exit = $result['exit_code'];
$this->log()->info('Command: {site}.{env} -- {command} [Exit: {exit}]', ['site' => $this->site->get('name'), 'env' => $this->environment->id, 'command' => escapeshellarg($command_line), 'exit' => $exit]);
if ($exit != 0) {
throw new TerminusException($output);
}
}
return rtrim($output);
}