public function Application::run in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/console/Application.php \Symfony\Component\Console\Application::run()
Runs the current application.
Parameters
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 doRun returns Exception
File
- vendor/
symfony/ console/ Application.php, line 107
Class
- Application
- An Application is the container for a collection of commands.
Namespace
Symfony\Component\ConsoleCode
public function run(InputInterface $input = null, OutputInterface $output = null) {
if (null === $input) {
$input = new ArgvInput();
}
if (null === $output) {
$output = new ConsoleOutput();
}
$this
->configureIO($input, $output);
try {
$exitCode = $this
->doRun($input, $output);
} catch (\Exception $e) {
if (!$this->catchExceptions) {
throw $e;
}
if ($output instanceof ConsoleOutputInterface) {
$this
->renderException($e, $output
->getErrorOutput());
}
else {
$this
->renderException($e, $output);
}
$exitCode = $e
->getCode();
if (is_numeric($exitCode)) {
$exitCode = (int) $exitCode;
if (0 === $exitCode) {
$exitCode = 1;
}
}
else {
$exitCode = 1;
}
}
if ($this->autoExit) {
if ($exitCode > 255) {
$exitCode = 255;
}
exit($exitCode);
}
return $exitCode;
}