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\MessengerView 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 |