Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. RunCommandMessageHandler.php

class RunCommandMessageHandler

@author Kevin Bond <kevinbond@gmail.com>

Hierarchy

  • class \Symfony\Component\Console\Messenger\RunCommandMessageHandler

Expanded class hierarchy of RunCommandMessageHandler

File

vendor/symfony/console/Messenger/RunCommandMessageHandler.php, line 23

Namespace

Symfony\Component\Console\Messenger
View source
final class RunCommandMessageHandler {
    public function __construct(Application $application) {
    }
    public function __invoke(RunCommandMessage $message) : RunCommandContext {
        $input = new StringInput($message->input);
        $output = new BufferedOutput();
        $this->application
            ->setCatchExceptions($message->catchExceptions);
        try {
            $exitCode = $this->application
                ->run($input, $output);
        } catch (\Throwable $e) {
            throw new RunCommandFailedException($e, new RunCommandContext($message, Command::FAILURE, $output->fetch()));
        }
        if ($message->throwOnFailure && Command::SUCCESS !== $exitCode) {
            throw new RunCommandFailedException(\sprintf('Command "%s" exited with code "%s".', $message->input, $exitCode), new RunCommandContext($message, $exitCode, $output->fetch()));
        }
        return new RunCommandContext($message, $exitCode, $output->fetch());
    }

}

Members

Title Sort descending Modifiers Object type Summary
RunCommandMessageHandler::__construct public function
RunCommandMessageHandler::__invoke public function

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal