protected static function executeCommand(CommandEvent $event, $appDir, $cmd, $timeout = 300) { $php = escapeshellarg(self::getPhp()); $console = escapeshellarg($appDir . '/console'); if ($event->getIO()->isDecorated()) { $console .= ' --ansi'; } $process = new Process($php . ' ' . $console . ' ' . $cmd, null, null, null, $timeout); $process->run(function ($type, $buffer) { echo $buffer; }); if (!$process->isSuccessful()) { throw new \RuntimeException(sprintf('An error occurred when executing the "%s" command.', escapeshellarg($cmd))); } }