From c24f058fd65bd371952be555b57ac4abc71d582d Mon Sep 17 00:00:00 2001 From: Alfred Bez Date: Fri, 9 Dec 2022 16:59:54 +0100 Subject: [PATCH] Check if GNU patch is used fixes #326 --- src/Plugin/Patches.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Plugin/Patches.php b/src/Plugin/Patches.php index 5e5cf220..d71018b4 100644 --- a/src/Plugin/Patches.php +++ b/src/Plugin/Patches.php @@ -443,6 +443,14 @@ protected function getAndApplyPatch(RemoteFilesystem $downloader, $install_path, // differences between how patch works on windows and unix. $patch_options = '--no-backup-if-mismatch'; if (PHP_OS_FAMILY == 'BSD') { + $patchVersion = ''; + $this->executor->execute('patch --version', $patchVersion); + if (strpos($patchBinaryVersion, 'GNU patch') === false) { + throw new \Exception( + "Please make sure to have GNU patch installed, see " + . "https://github.com/cweagans/composer-patches/wiki/Install-%22patch%22-binary" + ); + } $patch_options = '--posix --batch'; } foreach ($patch_levels as $patch_level) {