src/Viserio/Component/Console/Application.php
protected function doRunCommand(SymfonyCommand $command, InputInterface $input, OutputInterface $output): int
    {
        $this->runningCommand = $command;

        foreach ($command->getHelperSet() as $helper) {
            if ($helper instanceof InputAwareInterface) {
                $helper->setInput($input);
            }
        }

        if ($this->eventManager === null) {
            return $command->run($input, $output);
        }

        // bind before the console.command event, so the listeners have access to input options/arguments
        try {
            $command->mergeApplicationDefinition();
            $input->bind($command->getDefinition());
        } catch (ExceptionInterface $exception) {
            // ignore invalid options/arguments for now, to allow the event listeners to customize the InputDefinition
        }

        $event     = new ConsoleCommandEvent($command, $input, $output);
        $exception = null;

        try {
            $this->eventManager->trigger($event);

            if ($event->commandShouldRun()) {
                $exitCode = $command->run($input, $output);
            } else {
                $exitCode = ConsoleCommandEvent::RETURN_CODE_DISABLED;
            }
        } catch (Throwable $exception) {
            $this->eventManager->trigger($event = new ConsoleErrorEvent($command, $input, $output, $exception));
            $exception = $event->getError();

            if (($exitCode = $event->getExitCode()) === 0) {
                $exception = null;
            }
        }

        $this->eventManager->trigger($event = new ConsoleTerminateEvent($command, $input, $output, $exitCode));

        if ($exception !== null) {
            throw $exception;
        }

        return $event->getExitCode();
    }
protected function doRunCommand(SymfonyCommand $command, InputInterface $input, OutputInterface $output): int
    {
        $this->runningCommand = $command;

        foreach ($command->getHelperSet() as $helper) {
            if ($helper instanceof InputAwareInterface) {
                $helper->setInput($input);
            }
        }

        if ($this->eventManager === null) {
            return $command->run($input, $output);
        }

        // bind before the console.command event, so the listeners have access to input options/arguments
        try {
            $command->mergeApplicationDefinition();
            $input->bind($command->getDefinition());
        } catch (ExceptionInterface $exception) {
            // ignore invalid options/arguments for now, to allow the event listeners to customize the InputDefinition
        }

        $event     = new ConsoleCommandEvent($command, $input, $output);
        $exception = null;

        try {
            $this->eventManager->trigger($event);

            if ($event->commandShouldRun()) {
                $exitCode = $command->run($input, $output);
            } else {
                $exitCode = ConsoleCommandEvent::RETURN_CODE_DISABLED;
            }
        } catch (Throwable $exception) {
            $this->eventManager->trigger($event = new ConsoleErrorEvent($command, $input, $output, $exception));
            $exception = $event->getError();

            if (($exitCode = $event->getExitCode()) === 0) {
                $exception = null;
            }
        }

        $this->eventManager->trigger($event = new ConsoleTerminateEvent($command, $input, $output, $exitCode));

        if ($exception !== null) {
            throw $exception;
        }

        return $event->getExitCode();
    }
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.

@param \Symfony\Component\Console\Command\Command        $command
@param \Symfony\Component\Console\Input\InputInterface   $input
@param \Symfony\Component\Console\Output\OutputInterface $output

@throws \Throwable

@return int 0 if everything went fine, or an error code