protected function Application::doRunCommand in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/console/Application.php \Symfony\Component\Console\Application::doRunCommand()
Runs the current command.
If an event dispatcher has been attached to the application, events are also dispatched during the life-cycle of the command.
Parameters
Command $command A Command instance:
InputInterface $input An Input instance:
OutputInterface $output An Output instance:
Return value
int 0 if everything went fine, or an error code
Throws
\Exception when the command being run threw an exception
1 call to Application::doRunCommand()
- Application::doRun in vendor/
symfony/ console/ Application.php - Runs the current application.
File
- vendor/
symfony/ console/ Application.php, line 829
Class
- Application
- An Application is the container for a collection of commands.
Namespace
Symfony\Component\ConsoleCode
protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output) {
foreach ($command
->getHelperSet() as $helper) {
if ($helper instanceof InputAwareInterface) {
$helper
->setInput($input);
}
}
if (null === $this->dispatcher) {
return $command
->run($input, $output);
}
$event = new ConsoleCommandEvent($command, $input, $output);
$this->dispatcher
->dispatch(ConsoleEvents::COMMAND, $event);
if ($event
->commandShouldRun()) {
try {
$exitCode = $command
->run($input, $output);
} catch (\Exception $e) {
$event = new ConsoleExceptionEvent($command, $input, $output, $e, $e
->getCode());
$this->dispatcher
->dispatch(ConsoleEvents::EXCEPTION, $event);
$e = $event
->getException();
$event = new ConsoleTerminateEvent($command, $input, $output, $e
->getCode());
$this->dispatcher
->dispatch(ConsoleEvents::TERMINATE, $event);
throw $e;
}
}
else {
$exitCode = ConsoleCommandEvent::RETURN_CODE_DISABLED;
}
$event = new ConsoleTerminateEvent($command, $input, $output, $exitCode);
$this->dispatcher
->dispatch(ConsoleEvents::TERMINATE, $event);
return $event
->getExitCode();
}