Skip to content

Commit

Permalink
Exit on patch failure should use composer extra, not localPackage
Browse files Browse the repository at this point in the history
  • Loading branch information
Karl DeBisschop committed Nov 9, 2017
1 parent 4b1de2a commit a4519e8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Patches.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,10 @@ public function grabPatches()
*/
public function postInstall(PackageEvent $event)
{
// Check if we should exit in failure.
$extra = $this->composer->getPackage()->getExtra();
$exitOnFailure = getenv('COMPOSER_EXIT_ON_PATCH_FAILURE') || !empty($extra['composer-exit-on-patch-failure']);

// Get the package object for the current operation.
$operation = $event->getOperation();
/** @var PackageInterface $package */
Expand Down Expand Up @@ -321,7 +325,7 @@ public function postInstall(PackageEvent $event)
$e->getMessage() .
'</error>'
);
if (getenv('COMPOSER_EXIT_ON_PATCH_FAILURE') || !empty($extra['composer-exit-on-patch-failure'])) {
if ($exitOnFailure) {
throw new \Exception("Cannot apply patch $description ($url)!");
}
}
Expand Down

0 comments on commit a4519e8

Please sign in to comment.