Skip to content

Commit

Permalink
Catch runtime exception while initializing Composer to make sure a mi…
Browse files Browse the repository at this point in the history
…ssing composer.json does not fail >tryComposer, refs #11133
  • Loading branch information
Seldaek committed Oct 25, 2022
1 parent e5b8f2d commit 803e4e5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Composer/Console/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Composer\Util\Platform;
use Composer\Util\Silencer;
use LogicException;
use RuntimeException;
use Seld\Signal\SignalHandler;
use Symfony\Component\Console\Application as BaseApplication;
use Symfony\Component\Console\Exception\CommandNotFoundException;
Expand Down Expand Up @@ -512,6 +513,10 @@ public function getComposer(bool $required = true, ?bool $disablePlugins = null,
if ($required) {
throw $e;
}
} catch (RuntimeException $e) {
if ($required) {
throw $e;
}
}
}

Expand Down

0 comments on commit 803e4e5

Please sign in to comment.