protected static function executeCommand(CommandEvent $event, $cmd, array $options = array())
{
$php = escapeshellarg(self::getPhp());
$console = escapeshellarg(self::getConsoleDir($event) . '/console');
$cmd = escapeshellarg($cmd);
foreach ($options as $key => $option) {
$options[$key] = escapeshellarg($option);
}
if ($event->getIO()->isDecorated()) {
$console .= ' --ansi';
}
$process = new Process($php . ' ' . $console . ' ' . $cmd . ' ' . implode(' ', $options), null, null, null, 3600);
$process->run(function ($type, $buffer) use($event) {
$event->getIO()->write($buffer, false);
});
if (!$process->isSuccessful()) {
throw new \RuntimeException(sprintf('An error occurred when executing the "%s" command', escapeshellarg($cmd)));
}
}