RunCommandFailedException example

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($enew 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());
    }
}
Home | Imprint | This part of the site doesn't use cookies.