public static function executeCommand($commandIdentifier, array $settings, $outputResults = true, array $commandArguments = [])
{
$command = self::buildSubprocessCommand($commandIdentifier, $settings, $commandArguments);
$output = [];
// Output errors in response
$command .= ' 2>&1';
exec($command, $output, $result);
if ($result !== 0) {
if (count($output) > 0) {
$exceptionMessage = implode(PHP_EOL, $output);
} else {
$exceptionMessage = sprintf('Execution of subprocess failed with exit code %d without any further output. (Please check your PHP error log for possible Fatal errors)', $result);
}
throw new Exception\SubProcessException($exceptionMessage, 1355480641);
}
if ($outputResults) {
echo implode(PHP_EOL, $output);
}
return $result === 0;
}