szeidler / composer-patches-cli

Adds a CLI wrapper for cweagans/composer-patches
MIT License
28 stars 8 forks source link

Throw CLI error on "Cannot apply patch" #17

Closed nerdstein closed 4 years ago

nerdstein commented 4 years ago

Thank you so much for this project and your efforts. It is very helpful.

I came across an issue that the CLI does not throw an error code during a composer update command.

This would be tremendously helpful to fire an exit code when a patch fails.

  - Installing drupal/core (8.8.x-dev): Source already present
  - Applying patches for drupal/core
    https://www.drupal.org/files/issues/2018-11-26/2991895-15.patch (STM patch 564553073)
   Could not apply patch! Skipping. The error was: Cannot apply patch https://www.drupal.org/files/issues/2018-11-26/2991895-15.patch

This was after I ran the following commands:

composer patch-add drupal/core "STM patch 564553073" "https://www.drupal.org/files/issues/2018-11-26/2991895-15.patch"
The patch was successfully added.
Gathering patches from patch file.
Removing package drupal/core so that it can be re-installed and re-patched.
  - Removing drupal/core (8.9.x-dev), source is still present in core
> Drupal\Composer\Composer::ensureComposerVersion
Deleting core - not deleted

composer patch-add drupal/core "STM patch 1665039650" "https://www.drupal.org/files/issues/2018-12-10/2938803-52.patch"
The patch was successfully added.
  - Removing drupal/core (8.9.x-dev), source is still present in core
Gathering patches from patch file.
Removing package drupal/core so that it can be re-installed and re-patched.
> Drupal\Composer\Composer::ensureComposerVersion
Deleting core - not deleted
nerdstein commented 4 years ago

I've done a brief review of the code and this may actually be an upstream requirement for cweagens/composer-patches

nerdstein commented 4 years ago

Confirmed - https://github.com/cweagans/composer-patches#error-handling