protected function executeChild(CommandInterface $command, $name = null) { $name = $name ?: static::guessEventName($child); $event = new CommandEvent($name, $command); $this->getEventManager()->attach($name, function (CommandEvent $event) { $result = $event->getTarget()->execute(); $event->setResult($result); }); $this->getEventManager()->trigger($event); return $event->getResult(); }
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))); } }
public function __construct($command, $result) { parent::__construct($command); $this->result = $result; }
public function __construct($command, \Exception $exception) { parent::__construct($command); $this->exception = $exception; }
/** * Returns the available options defined in the composer file. * * @param CommandEvent $event Command event object * @return array Associative list of option keys and values */ protected static function getOptions(CommandEvent $event) { return $event->getComposer()->getPackage()->getExtra(); }