private static function executeCommand($cmd, Event $event)
{
$phpFinder = new PhpExecutableFinder();
if (false === ($phpPath = $phpFinder->find())) {
throw new \RuntimeException('The php executable could not be found.');
}
$process = new Process(sprintf('%s %s/console %s %s%s%s', $phpPath, self::getBinDir($event), $cmd, self::getWebDir($event), $event->getIO()->isDecorated() ? ' --ansi' : '', self::getVerbosityFlag($event)));
$process->run(function ($type, $buffer) use($event) {
$event->getIO()->write($buffer, false);
});
if (!$process->isSuccessful()) {
throw new \RuntimeException(sprintf('An error occurred while executing the "%s" command.', $cmd));
}
}