@@ -79,13 +79,18 @@ discard block |
||
| 79 | 79 | /** @var Console $console */ |
| 80 | 80 | $console = $this->container->get(Console::class); |
| 81 | 81 | |
| 82 | - try { |
|
| 82 | + try |
|
| 83 | + { |
|
| 83 | 84 | return $console->start($input ?? new ArgvInput(), $output); |
| 84 | - } catch (Throwable $e) { |
|
| 85 | + } |
|
| 86 | + catch (Throwable $e) |
|
| 87 | + { |
|
| 85 | 88 | $this->handleException($e, $output); |
| 86 | 89 | |
| 87 | 90 | return 255; |
| 88 | - } finally { |
|
| 91 | + } |
|
| 92 | + finally |
|
| 93 | + { |
|
| 89 | 94 | $listener->disable(); |
| 90 | 95 | $this->finalizer->finalize(false); |
| 91 | 96 | } |
@@ -97,9 +102,12 @@ discard block |
||
| 97 | 102 | */ |
| 98 | 103 | protected function handleException(Throwable $e, OutputInterface $output): void |
| 99 | 104 | { |
| 100 | - try { |
|
| 105 | + try |
|
| 106 | + { |
|
| 101 | 107 | $this->container->get(SnapshotterInterface::class)->register($e); |
| 102 | - } catch (Throwable | ContainerExceptionInterface $se) { |
|
| 108 | + } |
|
| 109 | + catch (Throwable | ContainerExceptionInterface $se) |
|
| 110 | + { |
|
| 103 | 111 | // no need to notify when unable to register an exception |
| 104 | 112 | } |
| 105 | 113 | |
@@ -114,11 +122,13 @@ discard block |
||
| 114 | 122 | */ |
| 115 | 123 | private function mapVerbosity(OutputInterface $output): int |
| 116 | 124 | { |
| 117 | - if ($output->isDebug()) { |
|
| 125 | + if ($output->isDebug()) |
|
| 126 | + { |
|
| 118 | 127 | return ConsoleHandler::VERBOSITY_DEBUG; |
| 119 | 128 | } |
| 120 | 129 | |
| 121 | - if ($output->isVeryVerbose()) { |
|
| 130 | + if ($output->isVeryVerbose()) |
|
| 131 | + { |
|
| 122 | 132 | return ConsoleHandler::VERBOSITY_VERBOSE; |
| 123 | 133 | } |
| 124 | 134 | |