logger = $logger; $this->kernel = $kernel; } /** * {@inheritdoc} */ public function run(CommandMessage $message): void { $application = new Application($this->kernel); $application->setAutoExit(false); $input = new ArrayInput( array_merge( ['command' => $message->getCommandName()], $message->getFormattedOptions(), $message->getArguments() ) ); $output = new BufferedOutput(); if ($application->run($input, $output) > 0) { $this->logger->error($output->fetch()); return; } echo $output->fetch(); } }